//
//  AppDelegate.m
//  easyTaxi
//
//  Created by ellenpage on 12-11-26.
//  Copyright (c) 2012年 ellenpage. All rights reserved.
//

#import "Constant.h"
#import "PassValueClass.h"
#import "GetPhoneInfo.h"
#import <CoreLocation/CLAvailability.h>
#import <CoreLocation/CLLocation.h>
#import <CoreLocation/CLLocationManager.h>
#import "UIDevice+IdentifierAddition.h"
#import "AppDelegate.h"
#import "DDXML.h"
#import "RequestCMD.h"
#import "ViewController.h"
#import "AppointmentVC.h"
#import "OrderVC.h"
#import "MoreVC.h"
#import "TTSWidget.h"
#import "PassMapValue.h"
#import "MobClick.h"
#import "HelpView.h"
#import "SysViewObject.h"
#import "MyLoadingView.h"
#import "AlixPay.h"
#import "AlixPayResult.h"
#import "DataVerifier.h"
#import <sys/utsname.h>
#import "SystemInfoView.h"
#import "PromptView.h"
#import <icallPlugin/plugin.h>
#import "VantagesVC.h"
#import "ActivityView.h"

bool isPulseOK;
bool isOrderOK;
bool isReconnectOK;

@interface AppDelegate ()

@property (retain, nonatomic) NSTimer *tmpTimer;//检测心跳是否正常的定时器
@property (retain, nonatomic) NSTimer *orderCheckTimer;
@property (retain, nonatomic) NSTimer *checkTimer;
@property (retain, nonatomic) NSTimer *reconnectTimer;
@property (retain, nonatomic) NSTimer *loadingTimer;

@property (retain, nonatomic) TTSWidget *ttsWidget;
@property (assign, nonatomic) NSUInteger tagValue;
@property (strong, nonatomic) MyLoadingView *loadingView;

@property (strong, nonatomic) VantagesVC *vantagesVC;

@property (strong, nonatomic) plugin  *mPlugin;
//@property (strong, nonatomic) Vehicle *vehice;

- (void)requestAddressListTime;//请求地址簿列表时间
- (void)requestAddressList;    //请求地址簿列表
- (void)upLoadAddressList;     //更新地址簿
- (void)checkAddressList:(DDXMLDocument *)xmlDoc;//跟服务器的地址比对


- (BOOL)isSingleTask;
- (void)parseURL:(NSURL *)url application:(UIApplication *)application;

@end

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{    
    [self umengTrack];
    [self startBaiduMap];
    [SocketObject sharedInstance].delegate = self;
    _ttsWidget = [[TTSWidget alloc] init];
    self.mPlugin = [[plugin alloc] init];
    [self getGPSInfo];
    [self getPhoneInfo];
    
    self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

    ViewController *vc1 = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil];
    AppointmentVC  *vc2 = [[AppointmentVC alloc]  initWithNibName:@"AppointmentVC"  bundle:nil];
    OrderVC        *vc3 = [[OrderVC alloc] initWithNibName:@"OrderVC" bundle:nil];
    MoreVC         *vc4 = [[MoreVC alloc]  initWithNibName:@"MoreVC"  bundle:nil];
        
    UINavigationController *nav1 = [[UINavigationController alloc] initWithRootViewController:vc1];
    nav1.navigationBarHidden = YES;
    UINavigationController *nav2 = [[UINavigationController alloc] initWithRootViewController:vc2];
    nav2.navigationBarHidden = YES;
    UINavigationController *nav3 = [[UINavigationController alloc] initWithRootViewController:vc3];
    nav3.navigationBarHidden = YES;
    UINavigationController *nav4 = [[UINavigationController alloc] initWithRootViewController:vc4];
    nav4.navigationBarHidden = YES;
    NSArray *vcs = @[nav1, nav2, nav3, nav4];
    
    [[PassMapValue sharedIntance] mapView];

    self.tabBarController = [[MainTabController alloc] init];
    self.tabBarController.viewControllers = vcs;
    
    self.window.rootViewController = self.tabBarController;

    self.window.backgroundColor = [UIColor whiteColor];
    
    [self.window makeKeyAndVisible];

    if (![[NSUserDefaults standardUserDefaults] boolForKey:kFirstTimeIn])
    {
        [[NSUserDefaults standardUserDefaults] setBool:YES forKey:kFirstTimeIn];
        [kWindow addSubview:[PassValueClass sharedIntance].helpView];
        [[PassValueClass sharedIntance].helpView showHelpView];
    }


    if ([self isSingleTask])
    {
		NSURL *url = [launchOptions objectForKey:@"UIApplicationLaunchOptionsURLKey"];
		if (nil != url)
        {
			[self parseURL:url application:application];
		}
	}
    
    [self addLoadingView];
    return YES;
}



- (void)applicationWillResignActive:(UIApplication *)application
{
    // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
    // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
}

- (void)applicationDidEnterBackground:(UIApplication *)application
{
    // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
    // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
}

- (void)applicationWillEnterForeground:(UIApplication *)application
{
    // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
}

- (void)applicationDidBecomeActive:(UIApplication *)application
{
    // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
}

- (void)applicationWillTerminate:(UIApplication *)application
{
    // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
}

#pragma mark - YouMeng - 友盟方法

- (void)umengTrack
{
    //    [MobClick setCrashReportEnabled:NO]; // 如果不需要捕捉异常，注释掉此行
    //    [MobClick setLogEnabled:YES];  // 打开友盟sdk调试，注意Release发布时需要注释掉此行,减少io消耗
    [MobClick setAppVersion:kVersionNo]; //参数为NSString * 类型,自定义app版本信息，如果不设置，默认从CFBundleVersion里取
    //
    [MobClick startWithAppkey:kUMENG_APPKEY reportPolicy:(ReportPolicy) REALTIME channelId:nil];
    //   reportPolicy为枚举类型,可以为 REALTIME, BATCH,SENDDAILY,SENDWIFIONLY几种
    //   channelId 为NSString * 类型，channelId 为nil或@""时,默认会被被当作@"App Store"渠道
    
    //      [MobClick checkUpdate];   //自动更新检查, 如果需要自定义更新请使用下面的方法,需要接收一个(NSDictionary *)appInfo的参数
    //    [MobClick checkUpdateWithDelegate:self selector:@selector(updateMethod:)];
    
    [MobClick updateOnlineConfig];  //在线参数配置
    
    //    1.6.8之前的初始化方法
    //    [MobClick setDelegate:self reportPolicy:REALTIME];  //建议使用新方法
    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(onlineConfigCallBack:) name:UMOnlineConfigDidFinishedNotification object:nil];
}

- (void)onlineConfigCallBack:(NSNotification *)note
{
    NSString *str = [note.userInfo objectForKey:@"IPType"];
    
    if ([str isEqualToString:@"1"])
    {
        [PassValueClass sharedIntance].ipStr = @"61.155.41.145";//无锡服务器
    }
    else
    {
      [PassValueClass sharedIntance].ipStr   = @"etaxiapi.ehave.cn";//正式服务器
    }
}


#pragma mark - StartBaiduMap - 启动百度地图

- (void)startBaiduMap
{
    //启动mapmanager
    _mapManager   = [[BMKMapManager alloc] init];
	BOOL MapStart = [_mapManager start:kBaiduMapKey generalDelegate:nil];
	if (!MapStart)
    {
		NSLog(@"Map start failed!");
	}
    else{
        NSLog(@"Map start succeed!");
    }
}

#pragma mark - GetGpsInfo   - 判断GPS是否打开

- (void)getGPSInfo
{
    bool locationService = [CLLocationManager locationServicesEnabled];
    if (!locationService)
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"GPS定位服务未打开" message:@"请进入'设置'-'隐私'-'定位服务'打开易打车的定位" delegate:self cancelButtonTitle:@"好的" otherButtonTitles:nil, nil];
        [alert show];
    }
}

#pragma mark - GetPhoneInfo - 判断当前设备信息和联网状态

- (void)getPhoneInfo
{
    NSString *versonStr = kVersionNo;
    [PassValueClass sharedIntance].versionStr = versonStr;//存版本号

    NSString *imsiStr = [GetPhoneInfo getCurrentIMSI];
    [PassValueClass sharedIntance].IMSIStr = imsiStr;//保存imsi
    
    NSString *channelNO = @"SYS";
    [PassValueClass sharedIntance].channellNoStr = channelNO;
    
    NSString *device        = [GetPhoneInfo getCurrentDevice];       //设备信息
        
    NSString *netWorkStatus = [GetPhoneInfo getCurrentNetworkStatus];//网络状态
    NSLog(@"netWorkStatus = %@---device = %@",netWorkStatus,device);
    
    [self startConnection];
    
    if ([netWorkStatus isEqualToString:@"no"])
    {
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"当前网络连接失败"
                                                        message:nil
                                                       delegate:self
                                              cancelButtonTitle:@"知道了"
                                              otherButtonTitles:nil, nil];
        [alert show];
        return;
    }
    else if ([netWorkStatus isEqualToString:@"3g"]  || [device isEqualToString:@"iPhone"])///发布程序时候改过来!!!!!!
    {
        [self startConnection];
    }
    else if ([netWorkStatus isEqualToString:@"wifi"]||[device isEqualToString:@"iPhone"])
    {
        [self startConnection];
    }
}

- (void)startConnection
{
    [[SocketObject sharedInstance] startConnection];//socket发起连接
} 

#pragma mark - GetSocketInfo - 判断socket连接情况

- (void)getSocketInfo
{

}

#pragma mark - SocketDelegate - Socket代理

- (void)socketIsConnected//连接成功
{
    [PassValueClass sharedIntance].isConnectToSocket = YES;
    NSLog(@"socketIsConnected连接成功");
}

- (void)socketIsDisConnected//连接失败
{
    [self cancelTheTimer];

    [PassValueClass sharedIntance].isConnectToSocket = NO;
    [PassValueClass sharedIntance].isLogin           = NO;
    NSLog(@"socketIsDisConnected");
    
    if (!_reconnectTimer)
    {
        [self reconnect];
        _reconnectTimer = [NSTimer scheduledTimerWithTimeInterval:10
                                                           target:self
                                                         selector:@selector(reconnect)
                                                         userInfo:nil
                                                          repeats:YES];
    }
}

- (void)reconnect
{
    if (isReconnectOK)
    {
        isReconnectOK = NO;

        [_reconnectTimer invalidate];
        _reconnectTimer = nil;
        
    }
    else
    {
        if (isWebOk)
        {
            return;
        }

        if (!isLoginOk)
        {
            NSString *lngStr  = [PassValueClass sharedIntance].lngStr;
            NSString *latStr  = [PassValueClass sharedIntance].latStr;
            NSString *cityStr = [PassValueClass sharedIntance].cityStr;
            NSString *IMSIStr = [PassValueClass sharedIntance].IMSIStr;
        
            if (lngStr != nil && latStr != nil && cityStr != nil && IMSIStr != nil)
            {
                [[SocketObject sharedInstance].gcdSocket connectToHost:[PassValueClass sharedIntance].ipStr onPort:[kSocketPort integerValue] error:nil];

                NSString *string    = [RequestCMD requestCMD:kUserLogIn];
                NSMutableData *data = [RequestCMD getWantedData:string];
            
                [[SocketObject sharedInstance].gcdSocket writeData:data withTimeout:-1 tag:kUserLogIn];//1001---socket写入数据
                [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
            }
            return;
         }
        isReconnectOK = YES;
    }
}

#pragma mark - SendPulse - 开登陆成功就开始发心跳

- (void)startSendPulse
{
    [self sendPulse];
    if (!_pulseTimer)
    {
        _pulseTimer = [NSTimer scheduledTimerWithTimeInterval:29 target:self selector:@selector(sendPulse) userInfo:nil repeats:YES];
    }
}

- (void)sendPulse
{
    NSString *string1011 = [RequestCMD requestCMD:kUserPulseRecord];
    NSMutableData *dataToSend1011 = [RequestCMD getWantedData:string1011];
    [[SocketObject sharedInstance].gcdSocket writeData:dataToSend1011 withTimeout:-1 tag:kUserPulseRecord];
}

- (NSUInteger)getWantedHeaderInterger:(NSData *)data //得到NSString的头的位数
{
    Byte *testbyte   = (Byte *)[data bytes];
    NSUInteger total = 0;
    int s  = 0;
    int s0 = testbyte[0] & 0xff;
    int s1 = testbyte[1] & 0xff;
    int s2 = testbyte[2] & 0xff;
    int s3 = testbyte[3] & 0xff;
    s3<<=24;
    s2<<=16;
    s1<<=8;
    s = s0|s1|s2|s3;
    total = s;
    return total;
}

#pragma mark - GetNearDrivers - 获取周围司机

- (void)getNearDrivers
{
    NSString *string1011 = [RequestCMD requestCMD:kNearDrivers];
    NSMutableData *dataToSend1011 = [RequestCMD getWantedData:string1011];
    [[SocketObject sharedInstance].gcdSocket writeData:dataToSend1011 withTimeout:-1 tag:kNearDrivers];
}

#pragma mark - Socket Delegate - Socket代理

- (void)socketIsReadData:(NSData *)dataValue tag:(long)tagValue
{
    if (_tagValue == 0)
    {
        NSUInteger length = [self getWantedHeaderInterger:dataValue];
        [[SocketObject sharedInstance].gcdSocket readDataToLength:length withTimeout:-1 tag:2];
        _tagValue = 2;
    }
    else if(_tagValue == 2)
    {
        NSString *datafinal = [[NSString alloc] initWithData:dataValue encoding:NSUTF8StringEncoding];
        [self parserData:datafinal];//解析xml
        [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:2];
        _tagValue = 0;
    }
}

- (void)socketIsWriteData:(long)tagValue
{
    /*
    switch (tagValue)
    {
        case kUserLogIn:      //1001---用户登录
        {
            [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
        }
            break;
        case kUserPulseRecord://1011---心跳
        {
            [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
        }
            break;
        case kUserInfo:       //1003---个人信息
        {
            [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
        }
            break;
        case kPublicInfo:     //1005---公共信息
        {
            [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
        }
            break;
            case kParameters: //3003---获取参数
        {
            [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
        }
            break;
            
        case kUserSetting:    //1015----获取地址簿
        {
            [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
        }
            break;
            
        case kCallTaxiRequest: //1007----打车请求发起
        {
            [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
        }
            break;

        case kUserLocation:   //1019---用户位置上报

        {
            [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
        }
            break;
            
        case kNearDrivers:    //3001---用户位置上报
        {
            [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
        }
            break;
            
        case kAddressList:    //1065---地址簿请求
        {
            [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
        }
            break;
        
        case kAddressListTimeStamp: //1078---地址簿时间
        {
            [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
        }
            break;
            
            case kAddressListUpdate://1067---更新地址簿
        {
            [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
        }
            break;
            
            case kQuaryLottary:    //1072----查询中奖列表
        {
            [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
        }
            break;
            
            case kStartLottary:    //1074---开始抽奖
        {
            [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
        }
            break;
            
        case kConfirmLottary:      //1076---确认抽奖
        {
            [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
        }
            break;
            
        case kTaxiAppointment:     //1035---预约打车
        {
            [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
        }
            break;
            
        case kDesignatedDriveInfo: //1027---预约代驾
        {
            [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
        }
            break;

        case kTaxiAppointmentCancel://1041---取消预约
        {
            [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
        }
            break;
            
        case kDesignatedDriveCancel://1033---取消代驾
        {
            [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
        }
            break;

        case kBillUnevaluated:     //1055---未评价订单
        {
            [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
        }
            break;
                        
        case kBillEvaluated:      //1057---已经评价订单
        {
            [[SocketObject sharedInstance].gcdSocket readDataToLength:4 withTimeout:-1 tag:0];
        }
            break;

        default:
            break;
    }*/
}

#pragma mark - XMLParserData - 解析xml

- (void)parserData:(NSString *)str
{
    if ([str hasPrefix:@"<PROTOCOL>"]||[str hasSuffix:@"</PROTOCOL>"])
    {
        DDXMLDocument *xmlDoc=[[DDXMLDocument alloc] initWithXMLString:str options:0 error:nil];        
        NSArray *array = [NSArray arrayWithArray:[xmlDoc nodesForXPath:kCmdXml error:nil]];
        
        if (array.count > 0)
        {
            DDXMLElement *info   = [array objectAtIndex:0];
            NSString     *string = [info stringValue];//内容值
            int cmd = [string intValue];
            switch (cmd)
            {
                case kUserLogInResponse ://1002---用户登陆反馈
                {
                        NSArray *array = [xmlDoc nodesForXPath:kResultXml error:nil];
                        NSString *resultStr = [[array objectAtIndex:0] stringValue];
                        if ([resultStr isEqualToString:@"1"])//登陆成功
                        {
                            [_loadingView showText:@"获取当前位置,登陆系统成功"];
                            
                            [PassValueClass sharedIntance].isLogin = YES;

                            //登陆成功立即开始发心跳
                            [self performSelector:@selector(startSendPulse) withObject:nil afterDelay:0.0f];
                            
                            [self performSelector:@selector(checkIsPulseOK) withObject:nil afterDelay:0.0f];
                            if (!_tmpTimer)
                            {
                                _tmpTimer = [NSTimer scheduledTimerWithTimeInterval:10 target:self selector:@selector(checkIsPulseOK) userInfo:nil repeats:YES];
                            }
                            [self getpilotCity];    //查询体验城市
                            [self getUserInfo];     //获取个人资料
                            [self getNearDrivers];  //登陆成功查找司机
                            [self getYuYueList];    //预约列表
                            [self getDaiJiaList];   //代驾列表
                            [self requestTradeList];//订单列表查询
                            [self checkMyBill];     //检查订单
                            [self requestTianZeUid];
                            
                            
                            //是否有活动                            
                            NSArray *activityArray = [xmlDoc nodesForXPath:kActivityTypeXml error:nil];
                            if (activityArray.count > 0)
                            {
                                NSString *tmpStr = [[activityArray objectAtIndex:0] stringValue];
                                NSLog(@"%@",tmpStr);

                                if ([tmpStr isEqualToString:@"1"])
                                {
                                    ActivityView *activityView = [[ActivityView alloc] init];
                                    [mWindow addSubview:activityView];
                                }
                            }                            
                        }
                        else if ([resultStr isEqualToString:@"-1"])//登录失败
                        {
                            NSLog(@"%@",xmlDoc);
                            NSArray *downloadArray = [xmlDoc nodesForXPath:kDownloadLinkXml error:nil];
                            if (downloadArray.count > 0)
                            {
                                NSString *downloadStr = [[downloadArray objectAtIndex:0] stringValue];
                                [PassValueClass sharedIntance].downloadStr = downloadStr;
                            }
                            
                            NSArray *array = [xmlDoc nodesForXPath:kUpdateXml error:nil];
                            NSString *updateStr;
                            if (array.count > 0)
                            {
                                updateStr = [[array objectAtIndex:0] stringValue];
                            }

                            if ([updateStr isEqualToString:@"1"])
                            {
                                UIAlertView *loginError=[[UIAlertView alloc]initWithTitle:@"更新提醒"
                                                                                  message:@"您好,我们的程序有了新版本,为了保证您的叫车体验,请直接点击前往下载最新版!"
                                                                                 delegate:self
                                                                        cancelButtonTitle:@"取消"
                                                                        otherButtonTitles:@"好的",nil];
                                loginError.tag = kUpdateAlert;
                                [loginError show];
                                return;
                            }
                            
                            UIAlertView *loginError=[[UIAlertView alloc]initWithTitle:@"登录失败"
                                                                              message:@"您好，可能是由于服务器或网络的错误登陆失败了"
                                                                             delegate:self
                                                                    cancelButtonTitle:@"退出重新登录"
                                                                    otherButtonTitles:nil];
                            [loginError show];
                        }
                }
                    break;
                    
                case kUserPulseResponse: //1012---心跳反馈
                {
//                    NSLog(@"1012%@",xmlDoc);
                    NSArray *array = [xmlDoc nodesForXPath:kResultXml error:nil];
                    if (array.count > 0)
                    {
                        NSString *resultStr = [[array objectAtIndex:0] stringValue];
                        if ([resultStr isEqualToString:@"1"])//心跳成功
                        {
                            NSLog(@"心跳正常");
                            isPulseOK = YES;
                        }
                        else                                 //心跳失败
                        {
                            NSLog(@"心跳异常");
                            isPulseOK = NO;
                        }
                     }
                 }
                    break;
                    
                case kUserInfoResponse: //1004---获取个人信息反馈
                {
                    [_loadingView showText:@"成功获取个人资料"];
                    
//                    NSLog(@"1004---获取个人信息反馈----%@",xmlDoc);
                    NSArray *array = [xmlDoc nodesForXPath:kResultXml error:nil];
                    if (array.count > 0)
                    {
                        NSString *resultStr = [[array objectAtIndex:0] stringValue];
                        if ([resultStr isEqualToString:@"1"])
                        {
                            
                        //--------------解析用户昵称,性别,电话,生日,范围列表--------------
                            NSArray *nickArray = [xmlDoc nodesForXPath:kNickXml error:nil];
                            if (nickArray.count > 0)
                            {
                                NSString *nickStr = [[nickArray objectAtIndex:0] stringValue];
                                [PassValueClass sharedIntance].nickNameStr = nickStr;
                            }
                            
                            NSArray *sexArray = [xmlDoc nodesForXPath:kSexXml error:nil];
                            if (sexArray.count > 0)
                            {
                                NSString *sexStr = [[sexArray objectAtIndex:0] stringValue];
                                [PassValueClass sharedIntance].sexStr = sexStr;
                            }
                            
                            NSArray *teleArray = [xmlDoc nodesForXPath:kTelephoneXml error:nil];
                            if (teleArray.count > 0)
                            {
                                NSString *teleStr = [[teleArray objectAtIndex:0] stringValue];
                                [PassValueClass sharedIntance].teleNumStr = teleStr;
                            }
                            
                            NSArray *birthArray = [xmlDoc nodesForXPath:kBirthDateXml error:nil];
                            if (birthArray.count > 0)
                            {
                                NSString *birthStr = [[birthArray objectAtIndex:0] stringValue];
                                [PassValueClass sharedIntance].birthStr = birthStr;
                                if ([birthStr length] > 0)
                                {
                                    [PassValueClass sharedIntance].birthYear  = [birthStr substringWithRange:NSMakeRange(0, 4)];
                                    [PassValueClass sharedIntance].birthMonth = [birthStr substringWithRange:NSMakeRange(5, 2)];
                                    [PassValueClass sharedIntance].birthDay   = [birthStr substringWithRange:NSMakeRange(8, 2)];
                                }
                            }
                            
                            NSArray *arrangeArray = [xmlDoc nodesForXPath:kArrangeXml error:nil];
                            if (arrangeArray.count > 0)
                            {
                                NSString *arrangeStr = [[arrangeArray objectAtIndex:0] stringValue];
                                [PassValueClass sharedIntance].arrangeStr = arrangeStr;
                            }
                            
                            NSArray *isBindedArray = [xmlDoc nodesForXPath:kIsBindedXml error:nil];
                            if (isBindedArray.count > 0)
                            {
                                NSString *isBindedStr = [[isBindedArray objectAtIndex:0] stringValue];
                                [PassValueClass sharedIntance].isBindedStr = isBindedStr;
                                NSLog(@"%@",isBindedStr);
                            }
                            
                            NSArray *scoreArray = [xmlDoc nodesForXPath:kScoreXml error:nil];
                            if (scoreArray.count > 0)
                            {
                                NSString *scoreStr = [[scoreArray objectAtIndex:0] stringValue];
                                [PassValueClass sharedIntance].scoreStr = scoreStr;
                            }

                            NSString *phoneStr   = [PassValueClass sharedIntance].teleNumStr;
                            NSString *nameStr    = [PassValueClass sharedIntance].nickNameStr;
                            NSString *sexStr     = [PassValueClass sharedIntance].sexStr;
                            NSString *arrangeStr = [PassValueClass sharedIntance].arrangeStr;
                            NSString *scoreStr   = [PassValueClass sharedIntance].scoreStr;
                            NSLog(@"%@--%@-%@--%@--%@",phoneStr,nameStr,sexStr,arrangeStr,scoreStr);
                            
                            
                            [[NSUserDefaults standardUserDefaults] setBool:NO forKey:kIsFromMoreView];
                            //--------------1005获取公共信息--------------
                            NSString *string    = [RequestCMD requestCMD:kPublicInfo];
                            NSMutableData *data = [RequestCMD getWantedData:string];
                            [[SocketObject sharedInstance].gcdSocket writeData:data withTimeout:-1 tag:kPublicInfo];
                        }
                        else
                        {
                            NSLog(@"获取个人信息失败");
                            return;
                        }
                    }
                }
                    break;
                    
                case kPublicResponse: //1006---获取公共信息反馈
                {
                    NSLog(@"kPublicResponse-----%@",xmlDoc);
                    NSArray *array = [xmlDoc nodesForXPath:kResultXml error:nil];
                    if (array.count > 0)
                    {
                        NSString *resultStr = [[array objectAtIndex:0] stringValue];
                        if ([resultStr isEqualToString:@"1"])
                        {
                            NSArray *mapLinkArray = [xmlDoc nodesForXPath:kMapLinkXml error:nil];
                            if (mapLinkArray.count > 0)
                            {
                                NSString *string = [[mapLinkArray objectAtIndex:0] stringValue];
                                [PassValueClass sharedIntance].maplinkStr = string;
                            }
                            
                            NSArray *downloadArray = [xmlDoc nodesForXPath:kDownloadLinkXml error:nil];
                            if (downloadArray.count > 0)
                            {
                                NSString *string = [[downloadArray objectAtIndex:0] stringValue];
                                [PassValueClass sharedIntance].downloadStr = string;
                            }
                            
                            NSArray *callLiastArray = [xmlDoc nodesForXPath:kCallListXml error:nil];
                            if (callLiastArray.count > 0)
                            {
                                DDXMLElement *cusinfo = [callLiastArray objectAtIndex:0];
                                NSArray *callArray = [cusinfo nodesForXPath:kCallXml error:nil];
                                if (callArray.count > 0)
                                {
                                    for (int i = 0; i < callArray.count ; i++)
                                    {
                                        NSString *string = [[callArray objectAtIndex:0] stringValue];
                                        [PassValueClass sharedIntance].callNumber = string ;
                                    }
                                }
                                else
                                {
                                    [PassValueClass sharedIntance].callNumber = nil;
                                }
                            }
                            
                            NSArray *versionArray = [xmlDoc nodesForXPath:kVerXml error:nil];

                            if (versionArray.count > 0)
                            {
                                NSString *versionStr    = [PassValueClass sharedIntance].versionStr;
                                NSString *newVersionStr = [[versionArray objectAtIndex:0] stringValue];
                                if ([versionStr intValue] < [newVersionStr intValue])
                                {
                                    [PassValueClass sharedIntance].versionStr_Server = newVersionStr;
                                    
                                    UIAlertView *newVerAlert=[[UIAlertView alloc]initWithTitle:nil
                                                                                       message:@"易打车有最新版本了，是否现在升级"
                                                                                      delegate:self
                                                                             cancelButtonTitle:@"以后再说"
                                                                             otherButtonTitles:@"升级",nil];
                                    newVerAlert.tag = kNewVerAlert;
                                    [newVerAlert show];
                                }
                                else
                                {
                                    
                                    if ([[NSUserDefaults standardUserDefaults] boolForKey:kIsFromMoreView])
                                    {
                                        UIAlertView *newVerAlert=[[UIAlertView alloc]initWithTitle:nil
                                                                                           message:@"已经最新版本了"
                                                                                          delegate:self
                                                                                 cancelButtonTitle:@"好的"
                                                                                 otherButtonTitles:nil,nil];
                                        [newVerAlert show];
                                        [[NSUserDefaults standardUserDefaults] setBool:NO forKey:kIsFromMoreView];
                                    }
                                }
                            }
                            
                            if (![[NSUserDefaults standardUserDefaults] boolForKey:kIsFromMoreView])
                            {
                                //--------------3003获取参数信息--------------
                                NSString *string    = [RequestCMD requestCMD:kParameters];
                                NSMutableData *data = [RequestCMD getWantedData:string];
                                [[SocketObject sharedInstance].gcdSocket writeData:data withTimeout:-1 tag:kParameters];
                            }
                        }
                        else
                        {
                            NSLog(@"获取公共信息失败");
                        }
                    }
                }
                    break;
                    
                    case kParametersResponse://3004---获取参数反馈
                {
                    NSArray *array = [xmlDoc nodesForXPath:kResultXml error:nil];
                    if (array.count > 0)
                    {
                        NSArray *pulse30sArray  = [xmlDoc nodesForXPath:kTimeStepXml   error:nil];
                        if (pulse30sArray.count > 0)
                        {
                            [PassValueClass sharedIntance].timeStep  = [[[pulse30sArray objectAtIndex:0] stringValue] intValue] / 1000;
                        }
                        
                        NSArray *update10sArray = [xmlDoc nodesForXPath:kTimeUpdateXml error:nil];
                        if (update10sArray.count > 0)
                        {
                            [PassValueClass sharedIntance].timeUpdate = [[[update10sArray objectAtIndex:0] stringValue] intValue] / 1000;
                        }
                        
                        NSArray *distance2000Array = [xmlDoc nodesForXPath:kDistanceArrangeXml error:nil];
                        if (distance2000Array.count > 0)
                        {
                            [PassValueClass sharedIntance].alertDistance = [[[distance2000Array objectAtIndex:0] stringValue] intValue];
                        }
                        
                        NSArray *messageGateWayArray = [xmlDoc nodesForXPath:kMsmNumberXml error:nil];
                        if (messageGateWayArray.count > 0)
                        {
                            [PassValueClass sharedIntance].messageGateWay = [[messageGateWayArray objectAtIndex:0] stringValue];
                        }
                        
                        NSArray *notifyUrlArray = [xmlDoc nodesForXPath:kNotifyUrlXml error:nil];
                        if (notifyUrlArray.count > 0)
                        {
                            [PassValueClass sharedIntance].notifyUrl = [[notifyUrlArray objectAtIndex:0] stringValue];
                        }

                        NSArray *getDaCheDouRecordArray = [xmlDoc nodesForXPath:kGetAndCostListXml error:nil];
                        if (getDaCheDouRecordArray.count > 0)
                        {
                            [PassValueClass sharedIntance].getAndCostListStr = [[getDaCheDouRecordArray objectAtIndex:0] stringValue];
                        }
                        
                        NSArray *messageGatewayNoArray = [xmlDoc nodesForXPath:kMessageGatewayXml error:nil];
                        if (messageGatewayNoArray.count > 0)
                        {
                            [PassValueClass sharedIntance].messageGatewayNoStr = [[messageGatewayNoArray objectAtIndex:0] stringValue];
                        }

                        [self requestAddressListTime];
                    }
                    else
                    {
                        NSLog(@"获取参数失败");
                    }
                }
                    break;
                    
                case kAddressListTimeStampResponse://1079-获取地址簿时间
                {
                    
//1.服务器端检测没有地址簿 1⃣ .本地端没有地址簿,则不用更新  2⃣ .本地端有地址簿,需要更新 
//2.服务端检测有地址簿    1⃣ .本地端的时间戳跟服务端的一致,则不需要更新  2⃣ .本地端与服务端不一致,以本地端为主 3⃣ .服务端有时间戳,本地端没有时间戳,以服务端为主
                    
                    NSArray *array = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    if ([resultStr isEqualToString:@"1"])
                    {
//                        NSLog(@"%@",xmlDoc);
                        NSArray *custominfo = [xmlDoc nodesForXPath:kTimeXml error:nil];
                        NSString *resultStr = [[custominfo objectAtIndex:0] stringValue];
                        if ([resultStr isEqualToString:@"0"])
                        {
                            
                            NSLog(@"地址为空");
                            NSDictionary *dict = [[NSUserDefaults standardUserDefaults] objectForKey:kMyAddressBook];
                            NSString *timeStrLocal = [dict objectForKey:kAddressBookTimeStamp];
                            NSLog(@"%@",timeStrLocal);
                            if (timeStrLocal != nil)//本地端有地址簿,更新地址
                            {
                                [self upLoadAddressList];
                            }
                        }
                        else
                        {
                            //本地地址库
                            NSDictionary *dict = [[NSUserDefaults standardUserDefaults] objectForKey:kMyAddressBook];
                            NSString *timeStrLocal = [dict objectForKey:kAddressBookTimeStamp];

                            //网络地址库
                            NSArray *timeStampArray = [xmlDoc nodesForXPath:kTimeStampsXml error:nil];
                            if (timeStampArray.count > 0)
                            {
                                NSString *timeStr = [[timeStampArray objectAtIndex:0] stringValue];
                                if ([timeStr isEqualToString:timeStrLocal])//地址最新
                                {
                                    NSLog(@"已经是最新的");
                                }
                                else if ([timeStr length] > 0 && [timeStrLocal length] == 0)//把服务器地址拉到本地
                                {
                                    [self requestAddressList];
                                }
                                else//不相等的更新本地端
                                {
                                    [self upLoadAddressList];
                                }
                            }
                        }
                    }
                    else
                    {
                        NSLog(@"1079获取地址簿失败");
                    }
                }
                    break;
                    
                case kAddressListResponse://1066-获取地址簿反馈
                {
                    NSArray  *array = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    if ([resultStr isEqualToString:@"1"])
                    {
                        [self checkAddressList:xmlDoc];
                    }
                    else
                    {
                        NSLog(@"1066获取地址簿失败");
                    }
                }
                    break;
                    
                case kAddressListUpdateResponse://1068--更新地址簿反馈
                {
//                    NSLog(@"%@",xmlDoc);
                    NSArray  *array = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    if ([resultStr isEqualToString:@"1"])
                    {
                        [self checkAddressList:xmlDoc];
                    }
                    else
                    {
                        NSLog(@"1068更新地址簿失败");
                    }
                }
                    break;
                    
                case kUserSettingResponse://1016---用户设置完成更新
                {
                    NSArray *array = [xmlDoc nodesForXPath:kResultXml error:nil];
                    if (array.count > 0)
                    {
                        NSLog(@"%@",array);
                    }
                    
                    NSArray *custominfo=nil;
                    NSString *dict1016=nil;
                    custominfo = [xmlDoc nodesForXPath:kResultXml error:nil];
                    DDXMLElement *cusinfo = [custominfo objectAtIndex:0];
                    dict1016 = [cusinfo stringValue];
                    int result1016 = [dict1016 intValue];
                    //保存成功后result==1
                    if(result1016==1)
                    {
                        
                        UIAlertView *customalert=[[UIAlertView alloc]initWithTitle:@"设置信息成功"
                                                                           message:@"您的信息已经保存成功，谢谢"
                                                                          delegate:self
                                                                 cancelButtonTitle:@"我知道了"
                                                                 otherButtonTitles:nil];
                        [customalert show];
                        
                    }
                    else
                    {
                        UIAlertView *customalert=[[UIAlertView alloc]initWithTitle:@"nil"
                                                                           message:@"网络故障,请重试"
                                                                          delegate:self
                                                                 cancelButtonTitle:@"我知道了"
                                                                 otherButtonTitles:nil];
                        [customalert show];
                    }
                }
                    break;
                    
                case kCallTaxiReply:  //1008--打车申请请求
                {
                    NSLog(@"1008--打车申请请求 - %@",xmlDoc);
                    NSArray *custominfo=nil;
                    NSString *dict1016=nil;
                    custominfo = [xmlDoc nodesForXPath:kResultXml error:nil];
                    DDXMLElement *cusinfo = [custominfo objectAtIndex:0];
                    dict1016 = [cusinfo stringValue];
                    int result1016 = [dict1016 intValue];
                    //打车订单成功后result==1
                    if(result1016==1)
                    {
                        UIAlertView *customalert=[[UIAlertView alloc]initWithTitle:@"打车请求发送成功"
                                                                           message:@"您的打车请求已发送，请耐心等待"
                                                                          delegate:self
                                                                 cancelButtonTitle:@"我知道了"
                                                                 otherButtonTitles:nil];
                        [customalert show];
                        
//                        [[SysViewObject sharedIntance].sysView synthesizeVoice:@"您的打车请求已发送，请耐心等待"];
                        
                        NSArray *requestId = [xmlDoc nodesForXPath:kRequestIDXml error:nil];
                        DDXMLElement *requset_here=[requestId objectAtIndex:0];
                        NSInteger orderNo = [[requset_here stringValue] intValue];
                        [PassValueClass sharedIntance].orderNO = orderNo;//存入orderNo-订单号;
                        
                        NSArray *checkNoArray = [xmlDoc nodesForXPath:kCheckNoXml error:nil];
                        if (checkNoArray.count > 0)
                        {
                            NSString *tmpStr = [[checkNoArray objectAtIndex:0] stringValue];
                            [PassValueClass sharedIntance].checkNoStr = tmpStr;
                        }
                        
                        NSArray *coinArray = [xmlDoc nodesForXPath:kCoinXml error:nil];
                        if (coinArray.count > 0)
                        {
                            NSString *tmpStr = [[coinArray objectAtIndex:0] stringValue];
                            [PassValueClass sharedIntance].daCheDouStr = tmpStr;
                            [[NSNotificationCenter defaultCenter] postNotificationName:kGetDaCheDouNoti object:nil];
                        }

                        
                        [self detectOrderResult]; //检测订单是否完成
                        [self sendLocationTimer]; //发送乘客端的位置
                    }
                    else
                    {
                        NSLog(@"打车失败");
                    }
                }
                    break;
                    
                //--------以下是正常请求之后的几种返回  1.1020---正常返回无应答 2.1009---司机接单应答 3.1026---取消{1.用户取消,用户超时,司机取消}
                    
                    
                case kUserLocationResopnse_NoAnswer://1020--用户位置上报--正常返回-没有司机应答
                {
                    NSArray *custominfo=nil;
                    NSString *dict1016=nil;
                    custominfo = [xmlDoc nodesForXPath:kResultXml error:nil];
                    DDXMLElement *cusinfo = [custominfo objectAtIndex:0];
                    dict1016 = [cusinfo stringValue];
                    int result1016 = [dict1016 intValue];
                    if(result1016==1)
                    {
                        NSLog(@"1020正常返回");
                    }
                    else
                    {
                        NSLog(@"1020返回失败");
                    }
                }
                    break;
                    
                case kUserCancelTaxiResponse://1014--用户取消
                {
                    [self cancelTheTimer];
                    
                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"取消打车成功!"
                                                                        message:nil
                                                                       delegate:self
                                                              cancelButtonTitle:@"确定"
                                                              otherButtonTitles:nil, nil];
                        [alert show];
                        
                        [[NSNotificationCenter defaultCenter] postNotificationName:kGetUserCancelNoti object:nil];
                    }
                    else
                    {
                        NSLog(@"1014返回失败");
                    }
                }
                    break;
                    
                case kUserLocationResopnse_DriverCancel://1026---司机取消订单
                {
                    NSArray *custominfo=nil;
                    NSString *dict1016=nil;
                    custominfo = [xmlDoc nodesForXPath:kResultXml error:nil];
                    DDXMLElement *cusinfo = [custominfo objectAtIndex:0];
                    dict1016 = [cusinfo stringValue];
                    int result1016 = [dict1016 intValue];
                    if(result1016  == 8)
                    {
                        [self cancelTheTimer];
                        
                        [[NSNotificationCenter defaultCenter] postNotificationName:kGetDriverCancelOrderNoti object:nil];
                        UIAlertView *cancelalert=[[UIAlertView alloc]initWithTitle:@"打车请求被取消"
                                                                           message:@"由于某些原因，您的打车请求被司机取消，请不要气馁"
                                                                          delegate:self
                                                                 cancelButtonTitle:@"我会继续努力的!" otherButtonTitles:nil];
                        [cancelalert show];
                        
                    }
                    else
                    {
                        NSLog(@"1026取消订单失败");
                    }
                }
                    break;

                case  kUserLocationResopnse_GetDriverAnswer://有司机接单--1009
                {
                    NSLog(@"有司机接单--1009 - %@",xmlDoc);
                
                    [PassValueClass sharedIntance].requestID_Driver  = nil;//订单清空
                    [PassValueClass sharedIntance].driverInfo_Driver = nil;//司机信息清空
                    [PassValueClass sharedIntance].carColor_Driver   = nil;//车子颜色清空
                    [PassValueClass sharedIntance].carNumer_Driver   = nil;//车牌号清空
                    [PassValueClass sharedIntance].phone_Driver      = nil;//司机手机号清空
                    [PassValueClass sharedIntance].lng_Driver        = nil;//司机经度清空
                    [PassValueClass sharedIntance].lat_Driver        = nil;//司机纬度清空
                    [PassValueClass sharedIntance].nickName_Driver   = nil;//司机名称清空
                    [PassValueClass sharedIntance].credit_Driver     = nil;//司机信誉度清空
                    [PassValueClass sharedIntance].goodEvaluation_Driver = nil;//司机好评清空
                    [PassValueClass sharedIntance].badEvaluation_Driver  = nil;//司机差评清空
                    
                    NSArray *custominfo=nil;
                    NSString *dict1016=nil;
                    custominfo = [xmlDoc nodesForXPath:kResultXml error:nil];
                    DDXMLElement *cusinfo = [custominfo objectAtIndex:0];
                    dict1016 = [cusinfo stringValue];
                    int result1016 = [dict1016 intValue];
                    if(result1016==1)
                    {
                        
                        //订单编号
                        NSArray *requestIDArray = [xmlDoc nodesForXPath:kRequestIDXml error:nil];
                        if (requestIDArray.count > 0)
                        {
                            NSString *tmpStr = [[requestIDArray objectAtIndex:0] stringValue];
                            [PassValueClass sharedIntance].requestID_Driver = tmpStr;
                        }

                        NSArray *array  = [xmlDoc nodesForXPath:kDriverXml error:nil];
                        NSString *driverInfo = [NSString stringWithFormat:@"%@",[array objectAtIndex:0]];

                        DDXMLDocument *driverInfoDoc = [[DDXMLDocument alloc] initWithXMLString:driverInfo options:0 error:nil];


                        //司机信息
                        NSArray *driverInfoArray = [driverInfoDoc nodesForXPath:kDriverInfoXml error:nil];
                        if (driverInfoArray.count > 0)
                        {
                            NSString *tmpStr = [[driverInfoArray objectAtIndex:0] stringValue];
                            [PassValueClass sharedIntance].driverInfo_Driver = tmpStr;
                        }
                        
                        //车子颜色
                        NSArray *carColorArray = [driverInfoDoc nodesForXPath:kColorXml error:nil];
                        if (carColorArray.count > 0)
                        {
                            NSString *tmpStr = [[carColorArray objectAtIndex:0] stringValue];
                            [PassValueClass sharedIntance].carColor_Driver = tmpStr;
                        }
                        
                        //车牌号
                        NSArray *carNumberArray = [driverInfoDoc nodesForXPath:kHPHMXml error:nil];
                        if (carNumberArray.count > 0)
                        {
                            NSString *tmpStr = [[carNumberArray objectAtIndex:0] stringValue];
                            [PassValueClass sharedIntance].carNumer_Driver = tmpStr;
                        }
                        
                        //司机手机
                        NSArray *phoneNameArray = [driverInfoDoc nodesForXPath:kTelephoneXml error:nil];
                        if (phoneNameArray.count > 0)
                        {
                            NSString *tmpStr = [[phoneNameArray objectAtIndex:0] stringValue];
                            [PassValueClass sharedIntance].phone_Driver = tmpStr;
                        }

                        //司机经度
                        NSArray *lngArray = [driverInfoDoc nodesForXPath:kLongitudeXml error:nil];
                        if (lngArray.count > 0)
                        {
                            NSString *tmpStr = [[lngArray objectAtIndex:0] stringValue];
                            [PassValueClass sharedIntance].lng_Driver = tmpStr;
                        }
                        
                        //司机纬度
                        NSArray *latArray = [driverInfoDoc nodesForXPath:kLatitudeXml error:nil];
                        if (latArray.count > 0)
                        {
                            NSString *tmpStr = [[latArray objectAtIndex:0] stringValue];
                            [PassValueClass sharedIntance].lat_Driver = tmpStr;
                        }
                        
                        //司机昵称
                        NSArray *driverNameArray = [driverInfoDoc nodesForXPath:kNickXml error:nil];
                        if (driverNameArray.count > 0)
                        {
                            NSString *tmpStr = [[driverNameArray objectAtIndex:0] stringValue];
                            [PassValueClass sharedIntance].nickName_Driver = tmpStr;
                        }
                        
//                        //订单编号
//                        NSArray *requestIDArray = [driverInfoDoc nodesForXPath:kRequestIDXml error:nil];
//                        if (requestIDArray.count > 0)
//                        {
//                            NSString *tmpStr = [[requestIDArray objectAtIndex:0] stringValue];
//                            [PassValueClass sharedIntance].requestID_Driver = tmpStr;
//                        }
                        
                        //司机信誉度
                        NSArray *creditArray = [driverInfoDoc nodesForXPath:kCreditXml error:nil];
                        if (creditArray.count > 0)
                        {
                            NSString *tmpStr = [[creditArray objectAtIndex:0] stringValue];
                            [PassValueClass sharedIntance].credit_Driver = tmpStr;
                        }
//
//                        //司机好评
//                        NSArray *goodEvaluationArray = [driverInfoDoc nodesForXPath:kGoodEvaluateXml error:nil];
//                        if (goodEvaluationArray.count > 0)
//                        {
//                            NSString *tmpStr = [[goodEvaluationArray objectAtIndex:0] stringValue];
//                            [PassValueClass sharedIntance].goodEvaluation_Driver = tmpStr;
//                        }
//                        
//                        //司机差评
//                        NSArray *badEvaluationArray = [driverInfoDoc nodesForXPath:kBadEvaluateXml error:nil];
//                        if (badEvaluationArray.count > 0)
//                        {
//                            NSString *tmpStr = [[badEvaluationArray objectAtIndex:0] stringValue];
//                            [PassValueClass sharedIntance].badEvaluation_Driver = tmpStr;
//                        }
                        
//                        [[SysViewObject sharedIntance].sysView synthesizeVoice:@"有司机接单,请您耐心等待"];
                        
                        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"有司机接单,请您耐心等待..."
                                                                        message:nil
                                                                       delegate:self
                                                              cancelButtonTitle:@"知道了"
                                                              otherButtonTitles:nil, nil];
                        [alert show];
                        
                        
                        [[NSNotificationCenter defaultCenter] postNotificationName:kGetDriverOrderNoti object:nil];
                    }
                    else
                    {
                        NSLog(@"1009司机接单失败");
                    }
                }
                    break;
                    
                    case kUserStatus://1021---用户状态列表
                {
                    NSLog(@"1021--%@",xmlDoc);
                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {                    
                        NSString *statusStr = [[[xmlDoc nodesForXPath:kStatusXml error:nil] objectAtIndex:0] stringValue];
                        
                        if ([statusStr isEqualToString:@"0"])
                        {
                            NSLog(@"1021正常返回-无接单");
                        }
                        else if ([statusStr isEqualToString:@"1"])//司机位置更新
                        {
                        NSString *lngStr;
                        NSString *latStr;
                        
                        //司机经度
                        NSArray *lngArray = [xmlDoc nodesForXPath:kLongitudeXml error:nil];
                        if (lngArray.count > 0)
                        {
                            lngStr = [[lngArray objectAtIndex:0] stringValue];
                        }
                        
                        //司机纬度
                        NSArray *latArray = [xmlDoc nodesForXPath:kLatitudeXml error:nil];
                        if (latArray.count > 0)
                        {
                            latStr = [[latArray objectAtIndex:0] stringValue];
                        }

                        CLLocationCoordinate2D cor2d;
                        cor2d.latitude  = [latStr floatValue];
                        cor2d.longitude = [lngStr floatValue];
                        
                        [[PassMapValue sharedIntance] uploadDriverPosition:cor2d];
                        
                    }
                        else if ([statusStr isEqualToString:@"2"])//司机取消订单
                        {
                            [self cancelTheTimer];
                            
                            [[NSNotificationCenter defaultCenter] postNotificationName:kGetDriverCancelOrderNoti object:nil];
                            UIAlertView *cancelalert=[[UIAlertView alloc]initWithTitle:@"打车请求被取消"
                                                                               message:@"由于某些原因，您的打车请求被司机取消，请不要气馁"
                                                                              delegate:self
                                                                     cancelButtonTitle:@"我会继续努力的!" otherButtonTitles:nil];
                            [cancelalert show];
                        }
                        
                        else if ([statusStr isEqualToString:@"3"])//司机确认上车
                        {
                        UIAlertView *noResult = [[UIAlertView alloc] initWithTitle:@"司机已经确认您上车,祝您一路顺风!" message:nil delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
                        [noResult show];

                        [[SysViewObject sharedIntance].sysView synthesizeVoice:@"感谢您的使用,祝您一路顺风"];

                        [self cancelTheTimer];
                        [[NSNotificationCenter defaultCenter] postNotificationName:kGetUserCancelNoti object:nil];
                        
                        [YouMengEvent YouMengEvent:kRequestOk_YouMeng];
                    }
                        else if ([statusStr isEqualToString:@"4"])//系统结束订单
                        {
                            UIAlertView *noResult = [[UIAlertView alloc] initWithTitle:@"系统结束订单" message:nil delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
                            [noResult show];
                            
                            [[SysViewObject sharedIntance].sysView synthesizeVoice:@"感谢您的使用,祝您一路顺风"];
                            
                            [self cancelTheTimer];
                            [[NSNotificationCenter defaultCenter] postNotificationName:kGetUserCancelNoti object:nil];

                        }
                    }
                    else if ([resultStr isEqualToString:@"-1"])
                    {
                        UIAlertView *noResult = [[UIAlertView alloc] initWithTitle:@"订单返回异常" message:nil delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
                        [noResult show];
                    }
                    else if ([resultStr isEqualToString:@"-2"])
                    {
                        UIAlertView *noResult = [[UIAlertView alloc] initWithTitle:@"订单不存在,请重新提交" message:nil delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
                        [noResult show];
                    }
                }
                    break;
                    
                case kBillFinishReponse://1050--用户结单
                {
                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        UIAlertView *noResult = [[UIAlertView alloc] initWithTitle:@"感谢您的使用,祝您一路顺风!" message:nil delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
                        [noResult show];

                        [[SysViewObject sharedIntance].sysView synthesizeVoice:@"感谢您的使用,祝您一路顺风"];

                        [self cancelTheTimer];
                        [[NSNotificationCenter defaultCenter] postNotificationName:kGetUserCancelNoti object:nil];
                        
                        [YouMengEvent YouMengEvent:kRequestOk_YouMeng];
                    }
                    else
                    {
                        NSLog(@"1014返回失败");
                    }
                }
                    break;
               
                //-------------------------------------------------------------------------------
                case kNearDriversResponse:      //3002----周围司机列表
                {
                    NSArray *custominfo = nil;
                    NSString *dict1016  = nil;
                    custominfo = [xmlDoc nodesForXPath:kResultXml error:nil];
                    DDXMLElement *cusinfo = [custominfo objectAtIndex:0];
                    dict1016 = [cusinfo stringValue];
                    int result1016 = [dict1016 intValue];
                    if(result1016  == 1)
                    {
                        NSMutableArray *driverArray = [NSMutableArray array];
                        
                        NSArray *array  = [xmlDoc nodesForXPath:kDriverListXml error:nil];
                        NSString *driverInfo = [NSString stringWithFormat:@"%@",[array objectAtIndex:0]];
                        DDXMLDocument *driverInfoDoc123 = [[DDXMLDocument alloc] initWithXMLString:driverInfo options:0 error:nil];
                            
                        NSArray *tmparray = [driverInfoDoc123 nodesForXPath:kDriverXml error:nil];
                        for (int i = 0; i < tmparray.count; i++)
                        {
                            NSMutableDictionary *driverDict = [NSMutableDictionary dictionary];

                            NSString *driverInfo = [NSString stringWithFormat:@"%@",[tmparray objectAtIndex:i]];
                            DDXMLDocument *driverInfoDoc = [[DDXMLDocument alloc] initWithXMLString:driverInfo options:0 error:nil];

                            //司机姓名
                            NSArray *nickArray = [driverInfoDoc nodesForXPath:kNickXml error:nil];
                            if (nickArray.count > 0)
                            {
                                NSString *nickStr = [[nickArray objectAtIndex:0] stringValue];
                                [driverDict setObject:nickStr forKey:kNick];
                            }

                            //司机经度
                            NSArray *lngArray = [driverInfoDoc nodesForXPath:kLongitudeXml error:nil];
                            if (lngArray.count > 0)
                            {
                                NSString *tmpStr = [[lngArray objectAtIndex:0] stringValue];
                                [driverDict setObject:tmpStr forKey:kLongitude];
                            }

                            //司机纬度
                            NSArray *latArray = [driverInfoDoc nodesForXPath:kLatitudeXml error:nil];
                            if (latArray.count > 0)
                            {
                                NSString *tmpStr = [[latArray objectAtIndex:0] stringValue];
                                [driverDict setObject:tmpStr forKey:kLatitude];
                            }
                            
                            //司机手机
                            NSArray *phoneNameArray = [driverInfoDoc nodesForXPath:kTelephoneXml error:nil];
                            if (phoneNameArray.count > 0)
                            {
                                NSString *tmpStr = [[phoneNameArray objectAtIndex:0] stringValue];
                                [driverDict setObject:tmpStr forKey:kTelephone];
                            }
                            
                            //车牌号
                            NSArray *carNumberArray = [driverInfoDoc nodesForXPath:kHPHMXml error:nil];
                            if (carNumberArray.count > 0)
                            {
                                NSString *tmpStr = [[carNumberArray objectAtIndex:0] stringValue];
                                [driverDict setObject:tmpStr forKey:kHPHM];
                            }
                            
                            //车子状态-0.离线 1.在线 2.载客
                            NSArray *statusArray = [driverInfoDoc nodesForXPath:kStatusXml error:nil];
                            if (statusArray.count > 0)
                            {
                                NSString *tmpStr = [[statusArray objectAtIndex:0] stringValue];
                                [driverDict setObject:tmpStr forKey:kStatus];
                            }
                            
                            //是否vip用户 0 不是 1 是
                            NSArray *vipArray = [driverInfoDoc nodesForXPath:kVipXml error:nil];
                            if (vipArray.count > 0)
                            {
                                NSString *tmpStr = [[vipArray objectAtIndex:0] stringValue];
                                [driverDict setObject:tmpStr forKey:kVip];
                            }
                            //车子颜色
                            NSArray *carColorArray = [driverInfoDoc nodesForXPath:kColorXml error:nil];
                            if (carColorArray.count > 0)
                            {
                                NSString *tmpStr = [[carColorArray objectAtIndex:0] stringValue];
                                [driverDict setObject:tmpStr forKey:kColor];
                            }
                            
                            //车辆空载状态
                            NSArray *carStatusArray = [driverInfoDoc nodesForXPath:kCarStatusXml error:nil];
                            if (carStatusArray.count > 0)
                            {
                                NSString *tmpStr = [[carStatusArray objectAtIndex:0] stringValue];
                                [driverDict setObject:tmpStr forKey:kCarStatus];
                            }
                            
                            //司机信誉度
                            NSArray *creditArray = [driverInfoDoc nodesForXPath:kCreditXml error:nil];
                            if (creditArray.count > 0)
                            {
                                NSString *tmpStr = [[creditArray objectAtIndex:0] stringValue];
                                [driverDict setObject:tmpStr forKey:kCredit];
                            }
                            
                            //司机好评
                            NSArray *goodEvaluationArray = [driverInfoDoc nodesForXPath:kGoodEvaluateXml error:nil];
                            if (goodEvaluationArray.count > 0)
                            {
                                NSString *tmpStr = [[goodEvaluationArray objectAtIndex:0] stringValue];
                                [driverDict setObject:tmpStr forKey:kGoodEvaluate];
                            }
                            
                            //司机差评
                            NSArray *badEvaluationArray = [driverInfoDoc nodesForXPath:kBadEvaluateXml error:nil];
                            if (badEvaluationArray.count > 0)
                            {
                                NSString *tmpStr = [[badEvaluationArray objectAtIndex:0] stringValue];
                                [driverDict setObject:tmpStr forKey:kBadEvaluate];
                            }
                            
                            [driverDict setObject:@"0" forKey:kIsTianZe];
                            
                            //插入一组数据
                            [driverArray addObject:driverDict];
                        }
                        
                        
                        NSString *phone = [PassValueClass sharedIntance].teleNumStr;
                        
                        NSInteger lat;
                        NSInteger lng;
                        
                        if ([PassValueClass sharedIntance].lon_Tianze != 0.00000 && [PassValueClass sharedIntance].lat_Tianze != 0.00000)
                        {
                            lat   = [PassValueClass sharedIntance].lat_Tianze * 3600000;
                            lng   = [PassValueClass sharedIntance].lon_Tianze * 3600000;
                        }
                        else
                        {
                            lat   = [[PassValueClass sharedIntance].tmpLatStr  floatValue] * 3600000;
                            lng   = [[PassValueClass sharedIntance].tmpLngStr  floatValue] * 3600000;
                        }
                        
                        NSArray *driverArray_Tianze = [self.mPlugin getVehicle:phone bylat:lat bylon:lng];
                        
                        for (int i = 0; i < driverArray_Tianze.count; i++)
                        {
                            NSMutableDictionary *driverDict_TianZe = [NSMutableDictionary dictionary];

                            Vehicle *tmpDict = [driverArray_Tianze objectAtIndex:i];
                            
                            [driverDict_TianZe setObject:@"1" forKey:kIsTianZe];//是否是天泽的车
                            
                            [driverDict_TianZe setObject:@"3" forKey:kStatus];  //一直在线

                            NSString *suidStr        = tmpDict.suid;
                            [driverDict_TianZe setObject:suidStr forKey:kSUID];

                            NSString *vehicelNameStr = tmpDict.vehicleName;;
                            [driverDict_TianZe setObject:vehicelNameStr forKey:kHPHM];

                            NSString *starStr        = tmpDict.star;
                            [driverDict_TianZe setObject:starStr forKey:kCredit];

                            NSString *conpanyStr     = tmpDict.driverName;
                            [driverDict_TianZe setObject:conpanyStr forKey:kNick];

                            CLLocationCoordinate2D location;
                            location.latitude  = [tmpDict.lat floatValue];
                            location.longitude = [tmpDict.lon floatValue];

                            NSDictionary *dict = BMKBaiduCoorForWgs84(location);
                            
                            CLLocationCoordinate2D baiduLocation = BMKCoorDictionaryDecode(dict);
                            float lat = baiduLocation.latitude;
                            float lon = baiduLocation.longitude;

                            NSString *latStr         = [NSString stringWithFormat:@"%f",lat];
                            [driverDict_TianZe setObject:latStr forKey:kLatitude];

                            NSNumber *lonStr         = [NSString stringWithFormat:@"%f",lon];
                            [driverDict_TianZe setObject:lonStr forKey:kLongitude];

                            //插入一组数据
                            [driverArray addObject:driverDict_TianZe];
                        }
                        
                        [PassValueClass sharedIntance].nearDriversArrsy = driverArray;

                        if (driverArray.count > 0)
                        {
                            [[PassMapValue sharedIntance] showDrivers];
                        }
                    }
                    else
                    {
                        NSLog(@"3002周围司机列表返回失败");
                    }
                }
                    break;
                //-------------------------------------------------------------------------------
                
                case kTaxiAppointmentCheckResponse://1038----预约查看
                {
                    NSArray *array = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        NSMutableArray *listArray = [NSMutableArray array];
                        
                        NSArray *array  = [xmlDoc nodesForXPath:kAppointmentListXml error:nil];                            
                        NSString *driverInfo = [NSString stringWithFormat:@"%@",[array objectAtIndex:0]];
                        
                        DDXMLDocument *driverInfoDoc = [[DDXMLDocument alloc] initWithXMLString:driverInfo options:0 error:nil];
                        NSArray *tmpArray = [driverInfoDoc nodesForXPath:kAppointXml error:nil];
                        for (int i = 0; i < tmpArray.count; i++)
                        {
                            NSMutableDictionary *yuyueListDict = [NSMutableDictionary dictionary];
                            
                            NSString *tmpInfo = [NSString stringWithFormat:@"%@",[tmpArray objectAtIndex:i]];
                            DDXMLDocument *driverInfoDoc = [[DDXMLDocument alloc] initWithXMLString:tmpInfo options:0 error:nil];
                            
                            //checkNo
                            NSArray *checkNoArray = [driverInfoDoc nodesForXPath:kCheckNoXml error:nil];
                            if (checkNoArray.count > 0)
                            {
                                NSString *tmpStr = [[checkNoArray objectAtIndex:0] stringValue];
                                [yuyueListDict setObject:tmpStr forKey:kCheckNo];
                            }

                            //类型 0 免费  1 收费
                            NSArray *typeArray = [driverInfoDoc nodesForXPath:kTypeXml error:nil];
                            if (typeArray.count > 0)
                            {
                                NSString *tmpStr = [[typeArray objectAtIndex:0] stringValue];
                                [yuyueListDict setObject:tmpStr forKey:kType];
                            }
                            
                            //消耗的打车豆
                            NSArray *costDaCheDouArray = [driverInfoDoc nodesForXPath:kCoinXml error:nil];
                            if (costDaCheDouArray.count > 0)
                            {
                                NSString *tmpStr = [[costDaCheDouArray objectAtIndex:0] stringValue];
                                [yuyueListDict setObject:tmpStr forKey:kCoin];
                            }
                            
                            //预约序列
                            NSArray *appointNoArray = [driverInfoDoc nodesForXPath:kAppointmentIDXml error:nil];
                            if (appointNoArray.count > 0)
                            {
                                NSString *tmpStr = [[appointNoArray objectAtIndex:0] stringValue];
                                [yuyueListDict setObject:tmpStr forKey:kAppointmentID];
                            }

                            //预约卡号
                            NSArray *imsiArray = [driverInfoDoc nodesForXPath:kIMSIXml error:nil];
                            if (imsiArray.count > 0)
                            {
                                NSString *tmpStr = [[imsiArray objectAtIndex:0] stringValue];
                                [yuyueListDict setObject:tmpStr forKey:kIMSI];
                            }

                            //手机号
                            NSArray *phoneArray = [driverInfoDoc nodesForXPath:kTelephoneXml error:nil];
                            if (phoneArray.count > 0)
                            {
                                NSString *tmpStr = [[phoneArray objectAtIndex:0] stringValue];
                                [yuyueListDict setObject:tmpStr forKey:kTelephone];
                            }

                            //发布时间
                            NSArray *timeArray = [driverInfoDoc nodesForXPath:kPublishTimeXml error:nil];
                            if (timeArray.count > 0)
                            {
                                NSString *tmpStr = [[timeArray objectAtIndex:0] stringValue];
                                [yuyueListDict setObject:tmpStr forKey:kPublishTime];
                            }
                            
                            //司机imsi
                            NSArray *imsiArray_Driver = [driverInfoDoc nodesForXPath:kDriverIMSIXml error:nil];
                            if (imsiArray_Driver.count > 0)
                            {
                                NSString *tmpStr = [[imsiArray_Driver objectAtIndex:0] stringValue];
                                [yuyueListDict setObject:tmpStr forKey:kDriverIMSI];
                            }

                            //司机姓名
                            NSArray *nameArray = [driverInfoDoc nodesForXPath:kDriverNameXml error:nil];
                            if (nameArray.count > 0)
                            
                            {
                                NSString *tmpStr = [[nameArray objectAtIndex:0] stringValue];
                                [yuyueListDict setObject:tmpStr forKey:kDriverName];
                            }
                            
                            //司机电话
                            NSArray *phoneArray_Driver = [driverInfoDoc nodesForXPath:kDriverPhoenXml error:nil];
                            if (phoneArray_Driver.count > 0)
                            {
                                NSString *tmpStr = [[phoneArray_Driver objectAtIndex:0] stringValue];
                                [yuyueListDict setObject:tmpStr forKey:kDriverPhoen];
                            }

                            //出发地
                            NSArray *depureArray = [driverInfoDoc nodesForXPath:kDepartureXml error:nil];
                            if (depureArray.count > 0)
                            {
                                NSString *tmpStr = [[depureArray objectAtIndex:0] stringValue];
                                [yuyueListDict setObject:tmpStr forKey:kDeparture];
                            }

                            //目的地
                            NSArray *desArray = [driverInfoDoc nodesForXPath:kDestinationXml error:nil];
                            if (desArray.count > 0)
                            {
                                NSString *tmpStr = [[desArray objectAtIndex:0] stringValue];
                                [yuyueListDict setObject:tmpStr forKey:kDestination];
                            }
                        
                            //预约时间
                            NSArray *appointTimeArray = [driverInfoDoc nodesForXPath:kAppointmentTimeXml error:nil];
                            if (appointTimeArray.count > 0)
                            {
                                NSString *tmpStr = [[appointTimeArray objectAtIndex:0] stringValue];
                                [yuyueListDict setObject:tmpStr forKey:kAppointmentTime];
                            }
                            
                            //当前经度
                            NSArray *lngArray = [driverInfoDoc nodesForXPath:kCurLongitudeXml error:nil];
                            if (lngArray.count > 0)
                            {
                                NSString *tmpStr = [[lngArray objectAtIndex:0] stringValue];
                                [yuyueListDict setObject:tmpStr forKey:kCurLongitude];
                            }
                        
                            //当前经度
                            NSArray *latArray = [driverInfoDoc nodesForXPath:kCurLatitudeXml error:nil];
                            if (latArray.count > 0)
                            {
                                NSString *tmpStr = [[latArray objectAtIndex:0] stringValue];
                                [yuyueListDict setObject:tmpStr forKey:kCurLatitude];
                            }

                            //区域编码
                            NSArray *areaArray = [driverInfoDoc nodesForXPath:kAreaCodeXml error:nil];
                            if (areaArray.count > 0)
                            {
                                NSString *tmpStr = [[areaArray objectAtIndex:0] stringValue];
                                [yuyueListDict setObject:tmpStr forKey:kAreaCode];
                            }
                        
                            //订单状态
                            NSArray *statusArray = [driverInfoDoc nodesForXPath:kStatusXml error:nil];
                            if (statusArray.count > 0)
                            {
                                NSString *tmpStr = [[statusArray objectAtIndex:0] stringValue];
                                [yuyueListDict setObject:tmpStr forKey:kStatus];
                            }

                            [listArray addObject:yuyueListDict];
                            

                        }
                        
                        if (listArray.count > 0)
                        {
                            [PassValueClass sharedIntance].yuYueHistoryArray = listArray;
                        }
                        else
                        {
                            [PassValueClass sharedIntance].yuYueHistoryArray = nil;
                        }
                        [[NSNotificationCenter defaultCenter] postNotificationName:kGetYuYueListNoti object:nil];
                        
                        [self requestDaCheDou];
                    }
                    else
                    {
                        NSLog(@"获取预约列表错误");
                    }
                }
                    break;
                
                case kDesignatedDriveCheckResponse://1030----代驾查看
                {
                    NSArray *array = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    NSLog(@"代驾list = %@",xmlDoc);
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        NSMutableArray *daijiaArray = [NSMutableArray array];
                        
                        NSArray *array  = [xmlDoc nodesForXPath:kThirdDrivingListXml error:nil];
                        NSString *driverInfo = [NSString stringWithFormat:@"%@",[array objectAtIndex:0]];
                        
                        DDXMLDocument *driverInfoDoc = [[DDXMLDocument alloc] initWithXMLString:driverInfo options:0 error:nil];
                        NSArray *tmpArray = [driverInfoDoc nodesForXPath:kThirdDrivingXml error:nil];
                        for (int i = 0; i < tmpArray.count; i++)
                        {
                            NSMutableDictionary *daiJiaListDict = [NSMutableDictionary dictionary];
                            
                            NSString *tmpInfo = [NSString stringWithFormat:@"%@",[tmpArray objectAtIndex:i]];
                            DDXMLDocument *driverInfoDoc = [[DDXMLDocument alloc] initWithXMLString:tmpInfo options:0 error:nil];
                            
                            //车辆类型
                            NSArray *cllxArray = [driverInfoDoc nodesForXPath:kCLLXXml error:nil];
                            if (cllxArray.count > 0)
                            {
                                NSString *tmpStr = [[cllxArray objectAtIndex:0] stringValue];
                                [daiJiaListDict setObject:tmpStr forKey:kCLLX];
                            }
                            
                            //代驾序列
                            NSArray *appointNoArray = [driverInfoDoc nodesForXPath:kThirdDrivingIDXml error:nil];
                            if (appointNoArray.count > 0)
                            {
                                NSString *tmpStr = [[appointNoArray objectAtIndex:0] stringValue];
                                [daiJiaListDict setObject:tmpStr forKey:kThirdDrivingID];
                            }
                            
                            //预约卡号
                            NSArray *imsiArray = [driverInfoDoc nodesForXPath:kIMSIXml error:nil];
                            if (imsiArray.count > 0)
                            {
                                NSString *tmpStr = [[imsiArray objectAtIndex:0] stringValue];
                                [daiJiaListDict setObject:tmpStr forKey:kIMSI];
                            }
                            
                            //手机号
                            NSArray *phoneArray = [driverInfoDoc nodesForXPath:kTelephoneXml error:nil];
                            if (phoneArray.count > 0)
                            {
                                NSString *tmpStr = [[phoneArray objectAtIndex:0] stringValue];
                                [daiJiaListDict setObject:tmpStr forKey:kTelephone];
                            }
                            
                            //发布时间
                            NSArray *timeArray = [driverInfoDoc nodesForXPath:kPublishTimeXml error:nil];
                            if (timeArray.count > 0)
                            {
                                NSString *tmpStr = [[timeArray objectAtIndex:0] stringValue];
                                [daiJiaListDict setObject:tmpStr forKey:kPublishTime];
                            }
                            
                            //司机imsi
                            NSArray *imsiArray_Driver = [driverInfoDoc nodesForXPath:kDriverIMSIXml error:nil];
                            if (imsiArray_Driver.count > 0)
                            {
                                NSString *tmpStr = [[imsiArray_Driver objectAtIndex:0] stringValue];
                                [daiJiaListDict setObject:tmpStr forKey:kDriverIMSI];
                            }
                            
                            //司机姓名
                            NSArray *nameArray = [driverInfoDoc nodesForXPath:kDriverNameXml error:nil];
                            if (nameArray.count > 0)
                                
                            {
                                NSString *tmpStr = [[nameArray objectAtIndex:0] stringValue];
                                [daiJiaListDict setObject:tmpStr forKey:kDriverName];
                            }
                            
                            //司机电话
                            NSArray *phoneArray_Driver = [driverInfoDoc nodesForXPath:kDriverPhoenXml error:nil];
                            if (phoneArray_Driver.count > 0)
                            {
                                NSString *tmpStr = [[phoneArray_Driver objectAtIndex:0] stringValue];
                                [daiJiaListDict setObject:tmpStr forKey:kDriverPhoen];
                            }
                            
                            //出发地
                            NSArray *depureArray = [driverInfoDoc nodesForXPath:kDepartureXml error:nil];
                            if (depureArray.count > 0)
                            {
                                NSString *tmpStr = [[depureArray objectAtIndex:0] stringValue];
                                [daiJiaListDict setObject:tmpStr forKey:kDeparture];
                            }
                            
                            //目的地
                            NSArray *desArray = [driverInfoDoc nodesForXPath:kDestinationXml error:nil];
                            if (desArray.count > 0)
                            {
                                NSString *tmpStr = [[desArray objectAtIndex:0] stringValue];
                                [daiJiaListDict setObject:tmpStr forKey:kDestination];
                            }
                            
                            //预约时间
                            NSArray *appointTimeArray = [driverInfoDoc nodesForXPath:kAppointmentTimeXml error:nil];
                            if (appointTimeArray.count > 0)
                            {
                                NSString *tmpStr = [[appointTimeArray objectAtIndex:0] stringValue];
                                [daiJiaListDict setObject:tmpStr forKey:kAppointmentTime];
                            }
                            
                            //当前经度
                            NSArray *lngArray = [driverInfoDoc nodesForXPath:kCurLongitudeXml error:nil];
                            if (lngArray.count > 0)
                            {
                                NSString *tmpStr = [[lngArray objectAtIndex:0] stringValue];
                                [daiJiaListDict setObject:tmpStr forKey:kCurLongitude];
                            }
                            
                            //当前经度
                            NSArray *latArray = [driverInfoDoc nodesForXPath:kCurLatitudeXml error:nil];
                            if (latArray.count > 0)
                            {
                                NSString *tmpStr = [[latArray objectAtIndex:0] stringValue];
                                [daiJiaListDict setObject:tmpStr forKey:kCurLatitude];
                            }
                            
                            //区域编码
                            NSArray *areaArray = [driverInfoDoc nodesForXPath:kAreaCodeXml error:nil];
                            if (areaArray.count > 0)
                            {
                                NSString *tmpStr = [[areaArray objectAtIndex:0] stringValue];
                                [daiJiaListDict setObject:tmpStr forKey:kAreaCode];
                            }
                            
                            //订单状态
                            NSArray *statusArray = [driverInfoDoc nodesForXPath:kStatusXml error:nil];
                            if (statusArray.count > 0)
                            {
                                NSString *tmpStr = [[statusArray objectAtIndex:0] stringValue];
                                [daiJiaListDict setObject:tmpStr forKey:kStatus];
                            }
                            
                            [daijiaArray addObject:daiJiaListDict];
                        }
                        if (daijiaArray.count > 0)
                        {
                            [PassValueClass sharedIntance].daJiaHistoryArray = daijiaArray;
                        }
                        else
                        {
                            [PassValueClass sharedIntance].daJiaHistoryArray = nil;
                        }
                        [[NSNotificationCenter defaultCenter] postNotificationName:kGetDaiJiaListNoti object:nil];
                    }
                    
                    else
                    {
                        NSLog(@"获取代驾列表错误");
                    }
                }
                    break;
                                        
                case kTaxiAppointmentResponse://1036----预约确认
                {
                    NSArray *array = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        NSLog(@"预约打车成功");

                        NSArray *daCheDouArray = [xmlDoc nodesForXPath:kCoinXml error:nil];
                        if (daCheDouArray.count > 0)
                        {
                            NSString *tmpStr = [[daCheDouArray objectAtIndex:0] stringValue];
                            [PassValueClass sharedIntance].daCheDouStr = tmpStr;
                        }

                        [self getYuYueList];  //更新预约列表
                    }
                    else
                    {
                        UIAlertView *noResult = [[UIAlertView alloc] initWithTitle:@"提交预约打车失败" message:nil delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
                        [noResult show];
                    }
                }
                    break;
                    
                case kDesignatedDriveInfoResponse: //1028----代驾确认
                {
                    NSArray *array = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        NSLog(@"预约代驾成功");
//                        NSString *appointmentID = [[[xmlDoc nodesForXPath:kThirdDrivingIDXml error:nil] objectAtIndex:0] stringValue];
//                        [PassValueClass sharedIntance].appointmentID_Daijia = appointmentID;
                        
                        [self getDaiJiaList]; //更新代驾列表
                    }
                    else
                    {
                        UIAlertView *noResult = [[UIAlertView alloc] initWithTitle:@"提交预约代驾失败" message:nil delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
                        [noResult show];
                    }
                }
                    break;
                    
                case kTaxiAppointmentCancelResponse://1042--取消预约打车返回
                {
//                    NSLog(@"%@",xmlDoc);
                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        [self getYuYueList];  //更新预约列表
                    }
                    else
                    {
                        UIAlertView *noResult = [[UIAlertView alloc] initWithTitle:@"取消预约打车失败" message:nil delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
                        [noResult show];
                    }
                }
                    break;
                    
                case kDesignatedDriveCancelResponse://1034--取消预约代驾返回
                {
                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        [self getDaiJiaList]; //更新代驾列表
                    }
                    else
                    {
                        UIAlertView *noResult = [[UIAlertView alloc] initWithTitle:@"取消预约代驾失败" message:nil delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
                        [noResult show];
                    }
                }
                    break;
               
                //-------------------------------------------------------------------------------
                case kQuaryLottaryResponse://1073---奖励列表
                {
                    NSArray *array = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    NSLog(@"1073 = %@",xmlDoc);
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        //积分规则
                        NSArray *ruleArray = [xmlDoc nodesForXPath:kRewordRuleDetailXml error:nil];
                        if (ruleArray.count > 0)
                        {
                            NSString *tmpStr = [[ruleArray objectAtIndex:0] stringValue];
                            NSArray *array = [tmpStr componentsSeparatedByString:@"|"];
//                            NSLog(@"%@",array);
                            [PassValueClass sharedIntance].ruleArray = [NSMutableArray arrayWithArray:array];
                        }
                        
                        //用户积分
                        NSArray *scoreArray = [xmlDoc nodesForXPath:kScoreXml error:nil];
                        if (scoreArray.count > 0)
                        {
                            NSString *tmpStr = [[scoreArray objectAtIndex:0] stringValue];
                            [PassValueClass sharedIntance].scoreStr = tmpStr;
                            
//                            UIAlertView *alertView  = [[UIAlertView alloc] initWithTitle:@"积分余额可以去抽奖~" message:@"是否直接去抽奖" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"去抽奖!", nil];
//                            alertView.tag = kJifenAlert;
//                            [alertView show];

                        }
                        
                        //消耗积分
                        NSArray *costArray = [xmlDoc nodesForXPath:kCostXml error:nil];
                        if (costArray.count > 0)
                        {
                            NSString *tmpStr = [[costArray objectAtIndex:0] stringValue];
                            [PassValueClass sharedIntance].costStr = tmpStr;
                        }
                        
                        //抽奖版本
                        NSArray *stageArray = [xmlDoc nodesForXPath:kRewordStageXml error:nil];
                        if (stageArray.count > 0)
                        {
                            NSString *tmpStr = [[stageArray objectAtIndex:0] stringValue];
                            [PassValueClass sharedIntance].rewordStage = tmpStr;
                        }

                        //列表
                        NSArray *rewordListArray = [xmlDoc nodesForXPath:kRewordListXml error:nil];
                        if (rewordListArray.count > 0)
                        {
                            DDXMLElement *reword = [rewordListArray objectAtIndex:0];
                            NSArray *rewirdArray = [reword nodesForXPath:kRewordXml error:nil];
                            
                            NSMutableArray *tmparray = [NSMutableArray array];
                            
                            for (int i = 0; i<rewirdArray.count; i++)
                            {
                                
                                DDXMLElement *rewordDetail = [rewirdArray objectAtIndex:i];
                                
                                NSMutableDictionary *tmpDict = [NSMutableDictionary dictionary];
                                
                                //序列号
                                NSArray *indexArray = [rewordDetail nodesForXPath:kRewordIndexXml error:nil];
                                if (indexArray.count > 0)
                                {
                                    NSString *tmpStr = [[indexArray objectAtIndex:i] stringValue];
                                    //                                    NSLog(@"%@",tmpStr);
                                    [tmpDict setObject:tmpStr forKey:kRewordIndex];
                                }
                                
                                //名称
                                NSArray *nameArray = [rewordDetail nodesForXPath:kRewordNameXml error:nil];
                                if (nameArray.count > 0)
                                {
                                    NSString *tmpStr = [[nameArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kRewordName];
                                }
                                
                                //类型
                                NSArray *typeArray = [rewordDetail nodesForXPath:kRewordTypeXml error:nil];
                                if (typeArray.count > 0)
                                {
                                    NSString *tmpStr = [[typeArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kRewordType];
                                }
                                
                                //图片url
                                NSArray *urlArray = [rewordDetail nodesForXPath:kRewordUrlXml error:nil];
                                if (typeArray.count > 0)
                                {
                                    NSString *tmpStr = [[urlArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kRewordUrl];
                                }

                                //图片版本
                                NSArray *picVersionArray = [rewordDetail nodesForXPath:kRewordUrlXml error:nil];
                                if (picVersionArray.count > 0)
                                {
                                    NSString *tmpStr = [[picVersionArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kRewordUrl];
                                }

                                
                                [tmparray addObject:tmpDict];
                            }
                            
                            [PassValueClass sharedIntance].rewordArray = tmparray;
                            NSLog(@"%@",[PassValueClass sharedIntance].rewordArray);
                            
                            //得到抽奖列表
                            [[NSNotificationCenter defaultCenter] postNotificationName:kGetLottoryArrary object:nil];
                        }
                    }
                    else
                    {
                        UIAlertView *noResult = [[UIAlertView alloc] initWithTitle:@"网络故障抽奖失败,请重试" message:nil delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
                        [noResult show];
                    }
                }
                    break;
                    
                case kStartLottaryResponse://1075---抽奖结果
                {
                    NSLog(@"1075---抽奖结果 = %@",xmlDoc);

                    NSArray *array = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        
                        NSMutableDictionary *tmpDict = [NSMutableDictionary dictionary];
                        
                        //序列号
                        NSArray *indexArray = [xmlDoc nodesForXPath:kRewordIndexXml error:nil];
                        if (indexArray.count > 0)
                        {
                            NSString *tmpStr = [[indexArray objectAtIndex:0] stringValue];
                            [tmpDict setObject:tmpStr forKey:kRewordIndex];
                        }
                        
                        //抽奖id
                        NSArray *idArray = [xmlDoc nodesForXPath:kRewordIdXml error:nil];
                        if (idArray.count > 0)
                        {
                            NSString *tmpStr = [[idArray objectAtIndex:0] stringValue];
                            [tmpDict setObject:tmpStr forKey:kRewordId];
                        }
                        
                        //类型
                        NSArray *typeArray = [xmlDoc nodesForXPath:kRewordTypeXml error:nil];
                        if (typeArray.count > 0)
                        {
                            NSString *tmpStr = [[typeArray objectAtIndex:0] stringValue];
                            [tmpDict setObject:tmpStr forKey:kRewordType];
                        }
                        
                        [PassValueClass sharedIntance].lottoryResultDict = tmpDict;
                        //得到抽奖结果
                        [[NSNotificationCenter defaultCenter] postNotificationName:kGetLottoryResult object:nil];
                    }
                    else
                    {
                        UIAlertView *noResult = [[UIAlertView alloc] initWithTitle:@"网络故障抽奖失败,请重试" message:nil delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil, nil];
                        [noResult show];
                    }
                }
                    break;
                    
                case kConfirmLottaryResponse://1077---抽奖确认
                {
                    NSArray *array = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    [PassValueClass sharedIntance].confirmResult = resultStr;
                    
                    //用户积分
                    NSArray *scoreArray = [xmlDoc nodesForXPath:kScoreXml error:nil];
                    if (scoreArray.count > 0)
                    {
                        NSString *tmpStr = [[scoreArray objectAtIndex:0] stringValue];
                        [PassValueClass sharedIntance].scoreStr = tmpStr;
                    }
                    
                    
                    //得到抽奖确认结果
                    [[NSNotificationCenter defaultCenter] postNotificationName:kGetLottoryConfirm object:nil];
                    
                }
                    break;
                //-------------------------------------------------------------------------------

                case kBillUnevaluatedReponse:    //1056--获取未评价订单
                {
                    NSLog(@"未评价订单 = %@",xmlDoc);
                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {                        
                        //未评价订单列表
                        NSArray *requestListArray = [xmlDoc nodesForXPath:kRequsetListXml error:nil];
                        if (requestListArray.count > 0)
                        {
                            DDXMLElement *reword = [requestListArray objectAtIndex:0];
                            
                            NSArray *requestItemArray = [reword nodesForXPath:kRequestItemXml error:nil];
                            
                            if (requestItemArray.count == 0)
                            {
                                [PassValueClass sharedIntance].noMoreUnevultedBill = YES;
                            }
                                                        
                            for (int i = 0; i<requestItemArray.count; i++)
                            {
                                DDXMLElement *rewordDetail = [requestItemArray objectAtIndex:i];
                                
                                NSMutableDictionary *tmpDict = [NSMutableDictionary dictionary];
                                
                                //订单编号
                                NSArray *numberArray = [rewordDetail nodesForXPath:kRequestIDXml error:nil];
                                if (numberArray.count > 0)
                                {
                                    NSString *tmpStr = [[numberArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kRequestID];
                                }
                                
                                //订单类型（1、打车 2、代驾 3、预约）
                                NSArray *requestTypeArray = [rewordDetail nodesForXPath:kRequestTypeXml error:nil];
                                if (requestTypeArray.count > 0)
                                {
                                    NSString *tmpStr = [[requestTypeArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kRequestType];
                                }

                                //发布时间
                                NSArray *requestTimeArray = [rewordDetail nodesForXPath:kPostTimeXml error:nil];
                                if (requestTimeArray.count > 0)
                                {
                                    NSString *tmpStr = [[requestTimeArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kPostTime];
                                }

                                //出发经度
                                NSArray *currentLatArray = [rewordDetail nodesForXPath:kCurLatitudeXml error:nil];
                                if (currentLatArray.count > 0)
                                {
                                    NSString *tmpStr = [[currentLatArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kCurLatitude];
                                }

                                //出发纬度
                                NSArray *currentLngArray = [rewordDetail nodesForXPath:kCurLongitudeXml error:nil];
                                if (currentLngArray.count > 0)
                                {
                                    NSString *tmpStr = [[currentLngArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kCurLongitude];
                                }

                                //目的地经度
                                NSArray *desLatArray = [rewordDetail nodesForXPath:kDesLatitudeXml error:nil];
                                if (desLatArray.count > 0)
                                {
                                    NSString *tmpStr = [[desLatArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kDesLatitude];
                                }
                                
                                //目的地纬度
                                NSArray *desLngArray = [rewordDetail nodesForXPath:kDesLongitudeXml error:nil];
                                if (desLngArray.count > 0)
                                {
                                    NSString *tmpStr = [[desLngArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kDesLongitude];
                                }
                                
                                //用户评价状态（0未评、1好评、2差评）
                                NSArray *userEvaluateArray = [rewordDetail nodesForXPath:kUserEvaluateXml error:nil];
                                if (userEvaluateArray.count > 0)
                                {
                                    NSString *tmpStr = [[userEvaluateArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kUserEvaluate];
                                }
                                
                                //司机评价状态（0未评、1好评、2差评）
                                NSArray *driverEvaluateArray = [rewordDetail nodesForXPath:kDriverEvaluateXml error:nil];
                                if (driverEvaluateArray.count > 0)
                                {
                                    NSString *tmpStr = [[driverEvaluateArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kDriverEvaluate];
                                }
                                
                                //用户评语
                                NSArray *userContentArray = [rewordDetail nodesForXPath:kUserEvaluationXml error:nil];
                                if (userContentArray.count > 0)
                                {
                                    NSString *tmpStr = [[userContentArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kUserEvaluate];
                                }
                                
                                //司机评语
                                NSArray *driverContentArray = [rewordDetail nodesForXPath:kDriverEvaluationXml error:nil];
                                if (driverContentArray.count > 0)
                                {
                                    NSString *tmpStr = [[driverContentArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kDriverEvaluation];
                                }
                                
                                //申诉状态
                                NSArray *appealdArray = [rewordDetail nodesForXPath:kAppealedXml error:nil];
                                if (appealdArray.count > 0)
                                {
                                    NSString *tmpStr = [[appealdArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kAppealed];
                                }
                                
                                //车牌号码
                                NSArray *HPHMArray = [rewordDetail nodesForXPath:kHPHMXml error:nil];
                                if (HPHMArray.count > 0)
                                {
                                    NSString *tmpStr = [[HPHMArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kHPHM];
                                }
                                
                                //司机名称
                                NSArray *nickArray = [rewordDetail nodesForXPath:kNickXml error:nil];
                                if (nickArray.count > 0)
                                {
                                    NSString *tmpStr = [[nickArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kNick];
                                }

                                [[PassValueClass sharedIntance].unevaluatedArray addObject:tmpDict];
                            }
                            
                            //得到未评价列表
                            [[NSNotificationCenter defaultCenter] postNotificationName:kGetUnevaluatedBill object:nil];
                        }
                    }
                    else
                    {
                        UIAlertView *noResult = [[UIAlertView alloc] initWithTitle:@"获取未评价订单失败"
                                                                           message:nil
                                                                          delegate:self
                                                                 cancelButtonTitle:@"确定"
                                                                 otherButtonTitles:nil, nil];
                        [noResult show];
                    }
                }
                    break;
                    
                case kBillEvaluatedReponse:    //1058--获取已经评价订单
                {
                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
//                        NSLog(@"已经评价订单列表 = %@",xmlDoc);

                        //已经评价订单列表
                        NSArray *requestListArray = [xmlDoc nodesForXPath:kRequsetListXml error:nil];
                        if (requestListArray.count > 0)
                        {
                            DDXMLElement *reword = [requestListArray objectAtIndex:0];
                            NSArray *requestItemArray = [reword nodesForXPath:kRequestItemXml error:nil];
                            if (requestItemArray.count == 0)
                            {
                                [PassValueClass sharedIntance].noMoreevultedBill = YES;
                            }
                            
                            for (int i = 0; i<requestItemArray.count; i++)
                            {
                                DDXMLElement *rewordDetail = [requestItemArray objectAtIndex:i];
                                NSMutableDictionary *tmpDict = [NSMutableDictionary dictionary];
                                
                                //订单编号
                                NSArray *numberArray = [rewordDetail nodesForXPath:kRequestIDXml error:nil];
                                if (numberArray.count > 0)
                                {
                                    NSString *tmpStr = [[numberArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kRequestID];
                                }
                                
                                //订单类型（1、打车 2、代驾 3、预约）
                                NSArray *requestTypeArray = [rewordDetail nodesForXPath:kRequestTypeXml error:nil];
                                if (requestTypeArray.count > 0)
                                {
                                    NSString *tmpStr = [[requestTypeArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kRequestType];
                                }
                                
                                //发布时间
                                NSArray *requestTimeArray = [rewordDetail nodesForXPath:kPostTimeXml error:nil];
                                if (requestTimeArray.count > 0)
                                {
                                    NSString *tmpStr = [[requestTimeArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kPostTime];
                                }
                                
                                //出发经度
                                NSArray *currentLatArray = [rewordDetail nodesForXPath:kCurLatitudeXml error:nil];
                                if (currentLatArray.count > 0)
                                {
                                    NSString *tmpStr = [[currentLatArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kCurLatitude];
                                }
                                
                                //出发纬度
                                NSArray *currentLngArray = [rewordDetail nodesForXPath:kCurLongitudeXml error:nil];
                                if (currentLngArray.count > 0)
                                {
                                    NSString *tmpStr = [[currentLngArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kCurLongitude];
                                }
                                
                                //目的地经度
                                NSArray *desLatArray = [rewordDetail nodesForXPath:kDesLatitudeXml error:nil];
                                if (desLatArray.count > 0)
                                {
                                    NSString *tmpStr = [[desLatArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kDesLatitude];
                                }
                                
                                //目的地纬度
                                NSArray *desLngArray = [rewordDetail nodesForXPath:kDesLongitudeXml error:nil];
                                if (desLngArray.count > 0)
                                {
                                    NSString *tmpStr = [[desLngArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kDesLongitude];
                                }
                                
                                //用户评价状态（0未评、1好评、2差评）
                                NSArray *userEvaluateArray = [rewordDetail nodesForXPath:kUserEvaluateXml error:nil];
                                if (userEvaluateArray.count > 0)
                                {
                                    NSString *tmpStr = [[userEvaluateArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kUserEvaluate];
                                }
                                
                                //司机评价状态（0未评、1好评、2差评）
                                NSArray *driverEvaluateArray = [rewordDetail nodesForXPath:kDriverEvaluateXml error:nil];
                                if (driverEvaluateArray.count > 0)
                                {
                                    NSString *tmpStr = [[driverEvaluateArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kDriverEvaluate];
                                }
                                
                                //用户评语
                                NSArray *userContentArray = [rewordDetail nodesForXPath:kUserEvaluationXml error:nil];
                                if (userContentArray.count > 0)
                                {
                                    NSString *tmpStr = [[userContentArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kUserEvaluate];
                                }
                                
                                //司机评语
                                NSArray *driverContentArray = [rewordDetail nodesForXPath:kDriverEvaluationXml error:nil];
                                if (driverContentArray.count > 0)
                                {
                                    NSString *tmpStr = [[driverContentArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kDriverEvaluation];
                                }
                                
                                //申诉状态
                                NSArray *appealdArray = [rewordDetail nodesForXPath:kAppealedXml error:nil];
                                if (appealdArray.count > 0)
                                {
                                    NSString *tmpStr = [[appealdArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kAppealed];
                                }
                                
                                //车牌号码
                                NSArray *HPHMArray = [rewordDetail nodesForXPath:kHPHMXml error:nil];
                                if (HPHMArray.count > 0)
                                {
                                    NSString *tmpStr = [[HPHMArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kHPHM];
                                }
                                
                                //司机名称
                                NSArray *nickArray = [rewordDetail nodesForXPath:kNickXml error:nil];
                                if (nickArray.count > 0)
                                {
                                    NSString *tmpStr = [[nickArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kNick];
                                }
                                
                                [[PassValueClass sharedIntance].evaluatedArray addObject:tmpDict];
                            }
                            
                            //得到已评价列表
                            [[NSNotificationCenter defaultCenter] postNotificationName:kGetevaluatedBill object:nil];
                        }
                    }
                    else
                    {
                        UIAlertView *noResult = [[UIAlertView alloc] initWithTitle:@"获取未评价订单失败"
                                                                           message:nil
                                                                          delegate:self
                                                                 cancelButtonTitle:@"确定"
                                                                 otherButtonTitles:nil, nil];
                        [noResult show];
                    }
                }
                    break;
                    
                case kBillEvaluationResponse://用户好评/差评返回
                {
                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        [PassValueClass sharedIntance].pageIndex = 0;
                        [PassValueClass sharedIntance].noMoreUnevultedBill = NO;
                        [[PassValueClass sharedIntance].unevaluatedArray removeAllObjects];
                        
                        [PassValueClass sharedIntance].pageIndex ++;
                        
                        //--------------------1055---未评价订单
                        NSString *string    = [RequestCMD requestCMD:kBillUnevaluated];
                        NSMutableData *data = [RequestCMD getWantedData:string];
                        [[SocketObject sharedInstance].gcdSocket writeData:data withTimeout:-1 tag:kBillUnevaluated];//1055---未评价订单
                        
                        [PassValueClass sharedIntance].pageIndex_Finished = 0;
                        [PassValueClass sharedIntance].noMoreevultedBill = NO;
                        [[PassValueClass sharedIntance].evaluatedArray removeAllObjects];
                        [PassValueClass sharedIntance].pageIndex_Finished ++;
                        
                        //--------------------1057---已经评价订单
                        NSString *tmpString    = [RequestCMD requestCMD:kBillEvaluated];
                        NSMutableData *datas = [RequestCMD getWantedData:tmpString];
                        [[SocketObject sharedInstance].gcdSocket writeData:datas withTimeout:-1 tag:kBillEvaluated];//1057---已经评价订单
                    }
                    else
                    {
                        NSLog(@"1060---用户好评返回失败");
                    }
                }
                    break;
                    
                case kUserComplainResponse://用户差评返回
                {
                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        [PassValueClass sharedIntance].pageIndex = 0;
                        [PassValueClass sharedIntance].noMoreUnevultedBill = NO;
                        [[PassValueClass sharedIntance].unevaluatedArray removeAllObjects];
                        
                        [PassValueClass sharedIntance].pageIndex ++;
                        
                        //--------------------1055---未评价订单
                        NSString *string    = [RequestCMD requestCMD:kBillUnevaluated];
                        NSMutableData *data = [RequestCMD getWantedData:string];
                        [[SocketObject sharedInstance].gcdSocket writeData:data withTimeout:-1 tag:kBillUnevaluated];//1055---未评价订单
                        
                        [PassValueClass sharedIntance].pageIndex_Finished = 0;
                        [PassValueClass sharedIntance].noMoreevultedBill = NO;
                        [[PassValueClass sharedIntance].evaluatedArray removeAllObjects];
                        [PassValueClass sharedIntance].pageIndex_Finished ++;
                        
                        //--------------------1057---已经评价订单
                        NSString *tmpString    = [RequestCMD requestCMD:kBillEvaluated];
                        NSMutableData *datas = [RequestCMD getWantedData:tmpString];
                        [[SocketObject sharedInstance].gcdSocket writeData:datas withTimeout:-1 tag:kBillEvaluated];//1057---已经评价订单
                    }
                    else
                    {
                        NSLog(@"1062---用户差评返回失败");
                    }
                }
                    break;
                    
                case 1069:
                {
                    //--------------------1070---获取新消息
                    NSString *tmpString    = [RequestCMD requestCMD:kSysInfo];
                    NSMutableData *datas = [RequestCMD getWantedData:tmpString];
                    [[SocketObject sharedInstance].gcdSocket writeData:datas withTimeout:-1 tag:kSysInfo];//1070---获取新消息
                }
                    break;
                    
                case kSysInfoResponse://1071--获取信息
                {
                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {

                        //收到信息列表
                        NSArray *requestListArray = [xmlDoc nodesForXPath:kMsmListXml error:nil];
                        if (requestListArray.count > 0)
                        {
                            DDXMLElement *reword = [requestListArray objectAtIndex:0];
                            NSArray *requestItemArray = [reword nodesForXPath:kMsmXml error:nil];
                            
                            NSMutableArray *listArray = [NSMutableArray arrayWithArray:[[NSUserDefaults standardUserDefaults] objectForKey:kMsmListArray]];
                            
                            if (listArray.count == 0)
                            {
                                listArray = [NSMutableArray array];
                            }

                            for (int i = 0; i<requestItemArray.count; i++)
                            {
                                DDXMLElement *rewordDetail = [requestItemArray objectAtIndex:i];
                                NSMutableDictionary *tmpDict = [NSMutableDictionary dictionary];
                                
                                //消息编号
                                NSArray *numberArray = [rewordDetail nodesForXPath:kMsmIdXml error:nil];
                                if (numberArray.count > 0)
                                {
                                    NSString *tmpStr = [[numberArray objectAtIndex:i] stringValue];
                                    
                                    
                                    [tmpDict setObject:tmpStr forKey:kMsmId];
                                }
                                
                                //消息类型
                                NSArray *requestTypeArray = [rewordDetail nodesForXPath:kMsmTypeXml error:nil];
                                if (requestTypeArray.count > 0)
                                {
                                    NSString *tmpStr = [[requestTypeArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kMsmType];
                                }
                                
                                //发布时间
                                NSArray *requestTimeArray = [rewordDetail nodesForXPath:kMsmPublishTimeXml error:nil];
                                if (requestTimeArray.count > 0)
                                {
                                    NSString *tmpStr = [[requestTimeArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kMsmPublishTime];
                                }
                                
                                //消息标题
                                NSArray *currentLatArray = [rewordDetail nodesForXPath:kMsmTitleXml error:nil];
                                if (currentLatArray.count > 0)
                                {
                                    NSString *tmpStr = [[currentLatArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kMsmTitle];
                                }
                                
                                //消息内容
                                NSArray *currentLngArray = [rewordDetail nodesForXPath:kMsmContentXml error:nil];
                                if (currentLngArray.count > 0)
                                {
                                    NSString *tmpStr = [[currentLngArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kMsmContent];
                                }
                                
                                //OUTTIME
                                NSArray *desLatArray = [rewordDetail nodesForXPath:kMsmOutTimeXml error:nil];
                                if (desLatArray.count > 0)
                                {
                                    NSString *tmpStr = [[desLatArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kMsmOutTime];
                                }
                            
                                [listArray addObject:tmpDict];
                            }
                            
                            if (listArray.count > 0)
                            {
                                [[NSUserDefaults standardUserDefaults] setObject:listArray forKey:kMsmListArray];
                            }
                        }
                    }
                    else
                    {
                        NSLog(@"1071收到信息失败");
                    }
                }
                    break;
                    
                case 4003:
                {
                    NSLog(@"收到推送信息 - %@",xmlDoc);
                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        [self requestDaCheDou];

                        [PassValueClass sharedIntance].isBindedStr = @"1";
                        [PassValueClass sharedIntance].isSignup    = YES;
                    
                        //消息内容
                        NSArray *currentLngArray = [xmlDoc nodesForXPath:kMsmContentXml error:nil];
                        if (currentLngArray.count > 0)
                        {
                            NSString *tmpStr = [[currentLngArray objectAtIndex:0] stringValue];
                            UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"系统消息"
                                                                            message:tmpStr
                                                                           delegate:self
                                                                  cancelButtonTitle:@"知道了"
                                                                  otherButtonTitles:nil, nil];
                            [alert show];
                        }
                        
                        //手机号码
                        NSArray *teleArray = [xmlDoc nodesForXPath:kTelephoneNoXml error:nil];
                        if (teleArray.count > 0)
                        {
                            NSString *tmpStr = [[teleArray objectAtIndex:0] stringValue];
                            [PassValueClass sharedIntance].teleNumStr = tmpStr;
                            NSLog(@"%@",[PassValueClass sharedIntance].teleNumStr);
                        }
                        
                        [YouMengEvent YouMengEvent:kLoginOk_YouMeng];
                    }
                }
                    break;
                    
                case 4001:
                {
                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        //消息类型
                        NSArray *logicArray = [xmlDoc nodesForXPath:kMsmLogicXml error:nil];
                        NSString *logic     = [[logicArray objectAtIndex:0] stringValue];
                        
                        //消息内容
                        NSArray  *currentLngArray = [xmlDoc nodesForXPath:kMsmContentXml error:nil];
                        NSString *contentStr      = [[currentLngArray objectAtIndex:0] stringValue];

                        if ([logic isEqualToString:kMessageScore])
                        {
                            //积分内容
                            NSArray  *currentScoreArray = [xmlDoc nodesForXPath:kScoreXml error:nil];
                            NSString *scoreStr          = [[currentScoreArray objectAtIndex:0] stringValue];
                            contentStr = [NSString stringWithFormat:@"当前积分是%@",scoreStr];
                        }

                        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"系统通知"
                                                                        message:contentStr
                                                                       delegate:self
                                                              cancelButtonTitle:@"知道了"
                                                              otherButtonTitles:nil, nil];
                        [alert show];
                        
                        if ([logic isEqualToString:kMessageScore])
                        {
                            //积分内容
                            NSArray  *currentScoreArray = [xmlDoc nodesForXPath:kScoreXml error:nil];
                            NSString *scoreStr          = [[currentScoreArray objectAtIndex:0] stringValue];
                            if ([scoreStr intValue] >= 10)
                            {
                                UIAlertView *alertView  = [[UIAlertView alloc] initWithTitle:@"积分余额可以去抽奖~" message:@"是否直接去抽奖" delegate:self cancelButtonTitle:@"取消" otherButtonTitles:@"去抽奖!", nil];
                                alertView.tag = kJifenAlert;
                                [alertView show];
                            }
                        }
                    }
                }
                    break;
                    
                case kPilotCityResponse://获得体验城市列表
                {
                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        //收到信息列表
                        NSArray *requestListArray = [xmlDoc nodesForXPath:kCityListxML error:nil];
                        if (requestListArray.count > 0)
                        {
                            DDXMLElement *reword = [requestListArray objectAtIndex:0];
                            NSArray *requestItemArray = [reword nodesForXPath:kCityXml error:nil];
                            
                            NSMutableArray *listArray = [NSMutableArray array];
                            
                            for (int i = 0; i<requestItemArray.count; i++)
                            {
                                DDXMLElement *rewordDetail = [requestItemArray objectAtIndex:i];
                                
                                NSMutableDictionary *tmpDict = [NSMutableDictionary dictionary];
                                
                                //城市名称
                                NSArray *nameArray = [rewordDetail nodesForXPath:kNameXml error:nil];
                                if (nameArray.count > 0)
                                {
                                    NSString *tmpStr = [[nameArray objectAtIndex:i] stringValue];                                    
                                    [tmpDict setObject:tmpStr forKey:kName];
                                    if ([tmpStr isEqualToString:[PassValueClass sharedIntance].cityStr])
                                    {
                                        [PassValueClass sharedIntance].isAvaliableCity = YES;
                                    }
                                }
                                
                                //城市编码
                                NSArray *areacodeArray = [rewordDetail nodesForXPath:kAreaCodeXml error:nil];
                                if (areacodeArray.count > 0)
                                {
                                    NSString *tmpStr = [[areacodeArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kAreaCode];
                                }
                                
                                //经度
                                NSArray *latArray = [rewordDetail nodesForXPath:kLatitudeXml error:nil];
                                if (latArray.count > 0)
                                {
                                    NSString *tmpStr = [[latArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kLatitude];
                                }
                                
                                //纬度
                                NSArray *lngArray = [rewordDetail nodesForXPath:kLongitudeXml error:nil];
                                if (lngArray.count > 0)
                                {
                                    NSString *tmpStr = [[lngArray objectAtIndex:i] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kLongitude];
                                }
                                
                                [listArray addObject:tmpDict];
                            }

                            if (listArray.count > 0)
                            {
                                [PassValueClass sharedIntance].politCityArray = [NSMutableArray arrayWithArray:listArray];
                                [[SysViewObject sharedIntance] reloadData];
                            }
                        }
                    }
                }
                    break;
                    
                case kLastBillResponse://--1048
                {

                    [_loadingTimer invalidate];
                    _loadingTimer = nil;
                    
                    [_loadingView hideWaiting];

                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                                        
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        NSString *statusStr = [[[xmlDoc nodesForXPath:kStatusXml error:nil] objectAtIndex:0] stringValue];
                        
                        [PassValueClass sharedIntance].statusStr = statusStr;
                        
                        if ([statusStr isEqualToString:@"-1"])
                        {
                            NSLog(@"没有打车订单");
                            return;
                        }
                        else
                        {
                            //checkNo
                            NSArray *checkNoArray = [xmlDoc nodesForXPath:kCheckNoXml error:nil];
                            if (checkNoArray.count > 0)
                            {
                                NSString *tmpStr = [[checkNoArray objectAtIndex:0] stringValue];
                                [PassValueClass sharedIntance].checkNoStr = tmpStr;
                            }
                            
                            //类型 0 免费  1 收费
                            NSArray *typeArray = [xmlDoc nodesForXPath:kTypeXml error:nil];
                            if (typeArray.count > 0)
                            {
                                NSString *tmpStr = [[typeArray objectAtIndex:0] stringValue];
                                [PassValueClass sharedIntance].typeStr = tmpStr;
                            }
                            
                            //打车豆
                            NSArray *daCheDouArray = [xmlDoc nodesForXPath:kCoinXml error:nil];
                            if (daCheDouArray.count > 0)
                            {
                                NSString *tmpStr = [[daCheDouArray objectAtIndex:0] stringValue];
                                [PassValueClass sharedIntance].costDaCheDou = tmpStr;
                            }
                            
                            [PassValueClass sharedIntance].billRestoreDict = [NSMutableDictionary dictionary];
                            
                            NSString *requestIDStr = [[[xmlDoc nodesForXPath:kRequestIDXml error:nil] objectAtIndex:0] stringValue];
                            [PassValueClass sharedIntance].orderNO = [requestIDStr integerValue];//存入orderNo-订单号;
                            NSLog(@"requestIDStr = %@",requestIDStr);

                            NSArray *array  = [xmlDoc nodesForXPath:kDriverXml error:nil];
                            if (array.count > 0)
                            {
                                NSString *driverInfo = [NSString stringWithFormat:@"%@",[array objectAtIndex:0]];
                                NSLog(@"%@",driverInfo);
                                DDXMLDocument *driverInfoDoc123 = [[DDXMLDocument alloc] initWithXMLString:driverInfo options:0 error:nil];
                                
                                NSString *imsiStr = [[[driverInfoDoc123 nodesForXPath:kIMSIXml error:nil] objectAtIndex:0] stringValue];
                                NSString *phoneStr = [[[driverInfoDoc123 nodesForXPath:kTelephoneXml error:nil] objectAtIndex:0] stringValue];
                                NSString *latStr = [[[driverInfoDoc123 nodesForXPath:kLatitudeXml error:nil] objectAtIndex:0] stringValue];
                                NSString *lngStr = [[[driverInfoDoc123 nodesForXPath:kLongitudeXml error:nil] objectAtIndex:0] stringValue];
                                NSString *colorStr = [[[driverInfoDoc123 nodesForXPath:kColorXml error:nil] objectAtIndex:0] stringValue];
                                NSString *hphmStr = [[[driverInfoDoc123 nodesForXPath:kHPHMXml error:nil] objectAtIndex:0] stringValue];
                                NSString *nicknameStr = [[[driverInfoDoc123 nodesForXPath:kNickXml error:nil] objectAtIndex:0] stringValue];
                                NSString *statusStr2 = [[[driverInfoDoc123 nodesForXPath:kStatusXml error:nil] objectAtIndex:0] stringValue];
                                
                                [[PassValueClass sharedIntance].billRestoreDict setObject:statusStr     forKey:kStatus];
                                [[PassValueClass sharedIntance].billRestoreDict setObject:requestIDStr  forKey:kRequestID];
                                [[PassValueClass sharedIntance].billRestoreDict setObject:imsiStr       forKey:kIMSI];
                                [[PassValueClass sharedIntance].billRestoreDict setObject:phoneStr      forKey:kTelephone];
                                [[PassValueClass sharedIntance].billRestoreDict setObject:latStr        forKey:kLatitude];
                                [[PassValueClass sharedIntance].billRestoreDict setObject:lngStr        forKey:kLongitude];
                                [[PassValueClass sharedIntance].billRestoreDict setObject:colorStr      forKey:kColor];
                                [[PassValueClass sharedIntance].billRestoreDict setObject:hphmStr       forKey:kHPHM];
                                [[PassValueClass sharedIntance].billRestoreDict setObject:nicknameStr   forKey:kNick];
                                [[PassValueClass sharedIntance].billRestoreDict setObject:statusStr2    forKey:kStatus_Driver];
                            }
                            
                            if ([statusStr isEqualToString:@"0"])//没有接单
                            {
                                [self detectOrderResult]; //检测订单是否完成
                                [self sendLocationTimer]; //发送乘客端的位置
                            }
                            
                            if ([statusStr isEqualToString:@"1"])//有接单
                            {
                                [self detectOrderResult]; //检测订单是否完成
                                [self sendLocationTimer]; //发送乘客端的位置
                            }
                            
                            [[NSNotificationCenter defaultCenter] postNotificationName:kBillRestore object:nil];

                        }
                    }
                    else
                    {
                        NSLog(@"获取上次订单失败");
                    }
                }
                    break;
                    
     //  -------- #pragma mark - 3.0 新接口 ---------
                case kRequestTradeListResponse:
                {                    
                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        
                        NSArray *daCheDouArray = [xmlDoc nodesForXPath:kCoinXml error:nil];
                        if (daCheDouArray.count > 0)
                        {
                            NSString *tmpStr = [[daCheDouArray objectAtIndex:0] stringValue];
                            [PassValueClass sharedIntance].daCheDouStr = tmpStr;
                        }

                        //收到信息列表
                        NSArray *requestListArray = [xmlDoc nodesForXPath:kTradeRuleListXml error:nil];
                        if (requestListArray.count > 0)
                        {
                            NSString *rewordStr = [NSString stringWithFormat:@"%@",[requestListArray objectAtIndex:0]];

                            DDXMLDocument *rewordDoc = [[DDXMLDocument alloc] initWithXMLString:rewordStr options:0 error:nil];

                            NSArray *requestItemArray = [rewordDoc nodesForXPath:kEachTradeRuleXml error:nil];
                            NSLog(@"requestItemArray = %@",requestItemArray);
                            
                            NSMutableArray *listArray = [NSMutableArray array];
                            
                            for (int i = 0; i<requestItemArray.count; i++)
                            {
                                NSMutableDictionary *tmpDict = [NSMutableDictionary dictionary];

                                NSString *rewordDetailStr = [NSString stringWithFormat:@"%@",[requestItemArray objectAtIndex:i]];
                                
                                DDXMLDocument *rewordDetail = [[DDXMLDocument alloc] initWithXMLString:rewordDetailStr options:0 error:nil];
                                                                                                
                                //节点名称
                                NSArray *nameArray = [rewordDetail nodesForXPath:kIndexXml error:nil];
                                NSLog(@"nameArray = %@",nameArray);
                                if (nameArray.count > 0)
                                {
                                    NSString *tmpStr = [[nameArray objectAtIndex:0] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kIndex];
                                }
                                
                                //充值金额
                                NSArray *areacodeArray = [rewordDetail nodesForXPath:kMoneyXml error:nil];
                                if (areacodeArray.count > 0)
                                {
                                    NSString *tmpStr = [[areacodeArray objectAtIndex:0] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kMoney];
                                }
                                
                                //得到打车豆数量
                                NSArray *latArray = [rewordDetail nodesForXPath:kCoinXml error:nil];
                                if (latArray.count > 0)
                                {
                                    NSString *tmpStr = [[latArray objectAtIndex:0] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kCoin];
                                }
                                
                                //额外送打车豆
                                NSArray *lngArray = [rewordDetail nodesForXPath:kExtraCoinXml error:nil];
                                if (lngArray.count > 0)
                                {
                                    NSString *tmpStr = [[lngArray objectAtIndex:0] stringValue];
                                    [tmpDict setObject:tmpStr forKey:kExtraCoin];
                                }
                                
                                [listArray addObject:tmpDict];
                                NSLog(@"listArray = %@",listArray);
                            }
                            
                            if (listArray.count > 0)
                            {
                                [PassValueClass sharedIntance].tradeListArray = [NSMutableArray arrayWithArray:listArray];
                            }
                        }
                    }
                }
                    break;
                    
                case kRequetTradeIDResponse:
                {
                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        NSArray *tradeIdArray = [xmlDoc nodesForXPath:kTradeIdXml error:nil];
                        if (tradeIdArray.count > 0)
                        {
                            NSString *tmpStr = [[tradeIdArray objectAtIndex:0] stringValue];
                            [PassValueClass sharedIntance].tradeNo = tmpStr;
                        }
                        
                        NSArray *indexArrary = [xmlDoc nodesForXPath:kIndexXml error:nil];
                        if (indexArrary.count > 0)
                        {
                            NSString *tmpStr = [[indexArrary objectAtIndex:0] stringValue];
                            [PassValueClass sharedIntance].choosedIndexStr = tmpStr;
                        }

                        [[NSNotificationCenter defaultCenter] postNotificationName:kGetTradeIdNoti object:nil];
                    }
                }
                    break;
                    
                case kRequetDaCheDouResponse:
                {
                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        NSArray *dachedouArray = [xmlDoc nodesForXPath:kCoinXml error:nil];
                        if (dachedouArray.count > 0)
                        {
                            NSString *tmpStr = [[dachedouArray objectAtIndex:0] stringValue];
//                            NSLog(@"%@",tmpStr);
                            [PassValueClass sharedIntance].daCheDouStr = tmpStr;
                            
                            [[NSNotificationCenter defaultCenter] postNotificationName:kGetDaCheDouNoti object:nil];
                        }
                    }
                }
                    break;
                   
                case kYueYuDingDanChange://用户预约状态改变的接口
                {
                    NSLog(@"%@",xmlDoc);
                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        NSString *idStr;
                        NSString *statusStr;
                        
                        NSArray *idArray = [xmlDoc nodesForXPath:kAppointmentIDXml error:nil];
                        if (idArray.count > 0)
                        {
                            NSString *tmpStr = [[idArray objectAtIndex:0] stringValue];
                            idStr = tmpStr;
                        }
                        
                        NSArray *statusArray = [xmlDoc nodesForXPath:kStatusXml error:nil];
                        if (statusArray.count > 0)
                        {
                            NSString *tmpStr = [[statusArray objectAtIndex:0] stringValue];
                            if ([tmpStr isEqualToString:@"0"])
                            {
                                statusStr = @"被司机接单";
                            }
                            if ([tmpStr isEqualToString:@"1"])
                            {
                                statusStr = @"被司机取消";
                            }
                            if ([tmpStr isEqualToString:@"2"])
                            {
                                statusStr = @"被司机确认上车";
                            }
                        }
                        
                        MBProgressHUD *HD = [[MBProgressHUD alloc] initWithView:kWindow];
                        [kWindow addSubview:HD];
                        NSString *showStr = [NSString stringWithFormat:@"预约订单:%@已经%@",idStr,statusStr];
                        HD.labelText = showStr;
                        [HD showAnimated:YES whileExecutingBlock:^{
                            //对话框显示时需要执行的操作
                            sleep(3);
                        } completionBlock:^{[HD removeFromSuperview];}];

                        [self getYuYueList];//刷新预约列表

                    }
                }
                    break;

                case kUserUpLoadNumResponse:
                {
                    NSLog(@"%@",xmlDoc);
                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        
                    }
                    else if ([resultStr isEqualToString:@"-1"])
                    {
                        PromptView *hintView = [[PromptView alloc] init];
                        CGRect rect1 = CGRectMake(0, 100, 320, 44);
                        [hintView showPrompt:@"对不起,网络故障请重试" withFrame:rect1 atView:kWindow];
                        NSLog(@"上传用户电话列表成功");
                    }
                }
                    
                    break;
                   
                case kTianZeUidResponse:
                {
                    NSLog(@"%@",xmlDoc);
                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    if ([resultStr isEqualToString:@"1"])//获取成功
                    {
                        NSArray *idArray = [xmlDoc nodesForXPath:kTianZeUidStrXml error:nil];
                        if (idArray.count > 0)
                        {
                            NSString *tmpStr = [[idArray objectAtIndex:0] stringValue];
                            NSLog(@"%@",tmpStr);
                            if ([tmpStr length] > 0)
                            {
                                [PassValueClass sharedIntance].tzUidStr = tmpStr;
                            }
                            else
                            {
                                [PassValueClass sharedIntance].tzUidStr = nil;
                            }
                        }
                    }
                }
                    break;
                    
                    
                case kUploadTianZeUidResponse:
                {
                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    if (![resultStr isEqualToString:@"1"])//上传uid失败
                    {
                        mAlertView(@"上传失败,请稍后再试~", nil);
                    }
                }
                    break;
                    
                case kUploadZhaoCheBaoOrderResponse:
                {
                    NSArray *array      = [xmlDoc nodesForXPath:kResultXml error:nil];
                    NSString *resultStr = [[array objectAtIndex:0] stringValue];
                    if ([resultStr isEqualToString:@"1"])
                    {
                        NSLog(@"上传成功");
                    }
                }
                    break;
                    
                default:
                    break;
            }
        }
    }
}

- (void)cancelTheTimer
{
    [_checkTimer invalidate];
    _checkTimer = nil;
    
    [_orderCheckTimer invalidate];
    _orderCheckTimer = nil;//也要取消检测轮询
}

- (void)checkIsPulseOK
{
    if (isPulseOK)
    {
        [_tmpTimer invalidate];
        _tmpTimer = nil;
    }
}

- (void)getUserInfo
{
    NSString *string    = [RequestCMD requestCMD:kUserInfo];//获取个人信息
    NSMutableData *data = [RequestCMD getWantedData:string];
    [[SocketObject sharedInstance].gcdSocket writeData:data withTimeout:-1 tag:kUserInfo];//获取个人信息
}

#pragma mark - Order Process - 打车流程

- (void)detectOrderResult//检测订单是否完成
{
    if (!_orderCheckTimer)
    {
        _orderCheckTimer = [NSTimer scheduledTimerWithTimeInterval:600
                                                            target:self
                                                          selector:@selector(orderFeedBack)
                                                          userInfo:nil
                                                           repeats:YES];
    }
}


- (void)orderFeedBack
{
    if (isOrderOK)
    {
        UIAlertView *noFeedBack=[[UIAlertView alloc]initWithTitle:@"您的打车请求长时间未得到相应"
                                                          message:@"亲，您已经发送打车请求好久了，还是没有司机接单，真是不好意思，可能司机都比较忙或者您没有填写目的地，您可以点击“取消打车”取消当前的打车请求，或者点击“取消”忽略这个弹出框。"
                                                         delegate:self
                                                cancelButtonTitle:@"取消打车"
                                                otherButtonTitles:@"取消",nil];
        noFeedBack.tag = kNoFeedBackAlert;
        [noFeedBack show];
    }
    else
    {
        [_orderCheckTimer invalidate];
        _orderCheckTimer = nil;
    }
}



- (void)sendLocationTimer
{
    if (!_checkTimer)
    {
        _checkTimer = [NSTimer scheduledTimerWithTimeInterval:10
                                                        target:self
                                                      selector:@selector(sendLocation)
                                                      userInfo:nil
                                                       repeats:YES];
    }
}

- (void)sendLocation
{
    NSString *string1011 = [RequestCMD requestCMD:kUserLocation];//1019---用户位置上报
    NSMutableData *dataToSend1011 = [RequestCMD getWantedData:string1011];
    [[SocketObject sharedInstance].gcdSocket writeData:dataToSend1011 withTimeout:-1 tag:kUserLocation];
}

#pragma mark - Msm Sign Up - 短信注册提示

- (void)showSignUpAlertView
{
    UIAlertView *signUpAlertView = [[UIAlertView alloc] initWithTitle:@"手机注册"
                                                              message:@"为了您的交易安全,请发送一条短信,完成注册"
                                                             delegate:self
                                                    cancelButtonTitle:@"稍后再试"
                                                    otherButtonTitles:@"发送短信", nil];
    signUpAlertView.tag = kSignUpAlert;
    [signUpAlertView show];
}

#pragma mark - YuYue&DaiJiaArray - 请求预约代驾列表

- (void)getYuYueList
{
    NSString *string    = [RequestCMD requestCMD:kTaxiAppointmentCheck];//请求预约列表
    NSMutableData *data = [RequestCMD getWantedData:string];
    [[SocketObject sharedInstance].gcdSocket writeData:data withTimeout:-1 tag:kTaxiAppointmentCheck];
}

- (void)getDaiJiaList
{
    NSString *string    = [RequestCMD requestCMD:kDesignatedDriveCheck];//请求代驾列表
    NSMutableData *data = [RequestCMD getWantedData:string];
    [[SocketObject sharedInstance].gcdSocket writeData:data withTimeout:-1 tag:kDesignatedDriveCheck];
}

#pragma mark - RequestAddressList - 请求地址簿

- (void)requestAddressListTime
{
    NSString *string    = [RequestCMD requestCMD:kAddressListTimeStamp];//请求地址簿时间
    NSMutableData *data = [RequestCMD getWantedData:string];
    [[SocketObject sharedInstance].gcdSocket writeData:data withTimeout:-1 tag:kAddressListTimeStamp];
}

- (void)requestAddressList
{
    NSString *string    = [RequestCMD requestCMD:kAddressList];//请求地址簿
    NSMutableData *data = [RequestCMD getWantedData:string];
    [[SocketObject sharedInstance].gcdSocket writeData:data withTimeout:-1 tag:kAddressList];
}

- (void)upLoadAddressList
{
    NSString *string    = [RequestCMD requestCMD:kAddressListUpdate];//更新地址簿
    NSMutableData *data = [RequestCMD getWantedData:string];
    [[SocketObject sharedInstance].gcdSocket writeData:data withTimeout:-1 tag:kAddressListUpdate];
}

- (void)checkAddressList:(DDXMLDocument *)xmlDoc//下载网络端的地址簿
{
    NSArray *timeArray = [xmlDoc nodesForXPath:kTimeStampsXml error:nil];
    NSString *timeStr = [[timeArray objectAtIndex:0] stringValue];

    NSMutableArray *detailsArray = [NSMutableArray array];//保存地址的数组
    
    NSArray *array = [xmlDoc nodesForXPath:kAddressListXml error:nil];
    if (array.count > 0)
    {
        DDXMLElement *cusinfo = [array objectAtIndex:0];
        NSArray *addressDetailArray = [cusinfo nodesForXPath:kAddressKeyXml error:nil];
        
        for (int i = 0; i < addressDetailArray.count; i++)
        {
            NSMutableDictionary *addressDict = [NSMutableDictionary dictionary];
            
            DDXMLElement *detail = [addressDetailArray objectAtIndex:i];
            
            NSArray *nameArray = [detail nodesForXPath:kAddressNameXml error:nil];//昵称
            if (nameArray.count > 0 )
            {
                NSString *tmpStr = [[nameArray objectAtIndex:0] stringValue];
                [addressDict setObject:tmpStr forKey:kAddressName];
            }
            
            NSArray *latArray  = [detail nodesForXPath:kLatitudeXml    error:nil];//纬度
            if (latArray.count > 0)
            {
                NSString *tmpStr = [[nameArray objectAtIndex:0] stringValue];
                [addressDict setObject:tmpStr forKey:kLatitude];
            }
            
            NSArray *lngArray  = [detail nodesForXPath:kLongitudeXml   error:nil];//经度
            if (lngArray.count > 0)
            {
                NSString *tmpStr = [[nameArray objectAtIndex:0] stringValue];
                [addressDict setObject:tmpStr forKey:kLongitude];
            }
            
            NSArray *areaArray = [detail nodesForXPath:kAreaCodeXml    error:nil];//编码
            if (areaArray.count > 0)
            {
                NSString *tmpStr = [[nameArray objectAtIndex:0] stringValue];
                [addressDict setObject:tmpStr forKey:kAreaCode];
            }
            
            NSArray *poiArray  = [detail nodesForXPath:kPoiNameXml     error:nil];//poi名称
            if (poiArray.count > 0)
            {
                NSString *tmpStr = [[nameArray objectAtIndex:0] stringValue];
                [addressDict setObject:tmpStr forKey:kPoiName];
            }
            
            NSArray *lastTimeArray  = [detail nodesForXPath:kLastTimeXml error:nil];//最近一次使用时间
            if (lastTimeArray.count > 0)
            {
                NSString *tmpStr = [[lastTimeArray objectAtIndex:0] stringValue];
                [addressDict setObject:tmpStr forKey:kLastTime];
            }
            
            [detailsArray addObject:addressDict];//一组数据加入数组中
        }
        
        if (addressDetailArray.count > 0)
        {
            NSMutableDictionary *dict = [NSMutableDictionary dictionary];
            [dict setObject:timeStr      forKey:kAddressBookTimeStamp];
            [dict setObject:detailsArray forKey:kAddressBookArray];
            [[NSUserDefaults standardUserDefaults] setObject:dict forKey:kMyAddressBook];
        }
    }
}

#pragma mark - AlertView Delegate - AlertView代理

- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
    int i = alertView.tag;
    switch (i)
    {
        case kUpdateAlert:
        {
            if (buttonIndex == 1)
            {
                NSString *urlStr = [PassValueClass sharedIntance].downloadStr;
                if (urlStr != nil)
                {
                    [[UIApplication sharedApplication]openURL:[NSURL URLWithString:urlStr]];
                }
            }
        }
            break;
            
        case kNewVerAlert://新版本升级
        {
            if (buttonIndex == 1)
            {
                NSString *urlStr = [PassValueClass sharedIntance].downloadStr;
                if (urlStr != nil)
                {
                    [[UIApplication sharedApplication]openURL:[NSURL URLWithString:urlStr]];
                }
            }
        }
            break;
            
        case kSignUpAlert:
        {
            if (buttonIndex == 1)
            {
                [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms://051085369098"]];
            }
        }
            break;
            
        case kNoFeedBackAlert://时间太久取消打车
        {
            if (buttonIndex == 1)
            {
                [_orderCheckTimer invalidate];
                _orderCheckTimer = nil;
                [[NSNotificationCenter defaultCenter] postNotificationName:kGetUserCancelNoti object:nil];
            }
        }
            break;
            
        case kNoServiceAlert:
        {
            if (buttonIndex == 2)
            {
                [self exitApplication];
            }
            else if (buttonIndex == 1)
            {
                [_loadingView hideWaiting];
                [_loadingTimer invalidate];
                _loadingTimer = nil;

                [[NSNotificationCenter defaultCenter] postNotificationName:kHandleLocation object:nil];
            }
            else if (buttonIndex == 0)
            {
                [_loadingView hideWaiting];
                [[NSNotificationCenter defaultCenter] postNotificationName:kRelocation object:nil];
            }
        }
            break;
            
        case kJifenAlert:
        {
            if (buttonIndex == 1)
            {
                if (!self.vantagesVC)
                {
                    self.vantagesVC = [[VantagesVC alloc] init];
                }
                [self.window.rootViewController.navigationController pushViewController:self.vantagesVC animated:YES];
            }
        }
            break;
            
        default:
            break;
    }
}


#pragma mark - PilotCity -体验城市列表

- (void)getpilotCity
{
    //--------------------1063---获取体验城市列表
    NSString *tmpString    = [RequestCMD requestCMD:kPilotCity];
    NSMutableData *datas   = [RequestCMD getWantedData:tmpString];
    [[SocketObject sharedInstance].gcdSocket writeData:datas withTimeout:-1 tag:kPilotCity];//1070---获取新消
}

#define mark - LastBill Request - 前一个订单的处理

- (void)checkMyBill
{
    //--------------------1047---上一个订单查询
    NSString *tmpString    = [RequestCMD requestCMD:kLastBill];
    NSMutableData *datas   = [RequestCMD getWantedData:tmpString];
    [[SocketObject sharedInstance].gcdSocket writeData:datas withTimeout:-1 tag:kLastBill];//1047---上一个订单查询
}


#pragma mark - 支付宝回调

- (BOOL)isSingleTask
{
	struct utsname name;
	uname(&name);
	float version = [[UIDevice currentDevice].systemVersion floatValue];//判定系统版本。
	if (version < 4.0 || strstr(name.machine, "iPod1,1") != 0 || strstr(name.machine, "iPod2,1") != 0) {
		return YES;
	}
	else {
		return NO;
	}
}


- (BOOL)application:(UIApplication *)application handleOpenURL:(NSURL *)url
{
	
	[self parseURL:url application:application];
	return YES;
}


- (void)parseURL:(NSURL *)url application:(UIApplication *)application
{
	AlixPay *alixpay = [AlixPay shared];
	AlixPayResult *result = [alixpay handleOpenURL:url];
	if (result) {
		//是否支付成功
		if (9000 == result.statusCode)
        {
            [YouMengEvent YouMengEvent:@"0021"];

			/*
			 *用公钥验证签名
			 */
			id<DataVerifier> verifier = CreateRSADataVerifier([[NSBundle mainBundle] objectForInfoDictionaryKey:@"RSA public key"]);
			if ([verifier verifyString:result.resultString withSign:result.signString]) {
				UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:@"提示"
																	 message:@"支付成功"
																	delegate:nil
														   cancelButtonTitle:@"确定"
														   otherButtonTitles:nil];
				[alertView show];
                
                [self requestDaCheDou];
                
			}//验签错误
			else
            {
				UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:@"提示"
																	 message:@"签名错误"
																	delegate:nil
														   cancelButtonTitle:@"确定"
														   otherButtonTitles:nil];
				[alertView show];
			}
		}
        
		//如果支付失败,可以通过result.statusCode查询错误码
		else {
			UIAlertView * alertView = [[UIAlertView alloc] initWithTitle:@"提示"
																 message:result.statusMessage
																delegate:nil
													   cancelButtonTitle:@"确定"
													   otherButtonTitles:nil];
			[alertView show];
		}
		
	}
}

#pragma mark - RequestTianZeUid - 获取天泽uid字符串

- (void)requestTianZeUid
{
    //-----------------------查询天泽uid字符串
    NSString *tmpString    = [RequestCMD requestCMD:kTianZeUid];
    NSMutableData *datas   = [RequestCMD getWantedData:tmpString];
    [[SocketObject sharedInstance].gcdSocket writeData:datas withTimeout:-1 tag:kTianZeUid];
}


#pragma mark - AddLoadingView -loading界面

- (void)addLoadingView
{
    _loadingView = [[MyLoadingView alloc] init];
    [_loadingView showWaiting:kWindow];
    [self addLoadingTimer];
}

- (void)addLoadingTimer
{
    if (!_loadingTimer)
    {
        _loadingTimer = [NSTimer scheduledTimerWithTimeInterval:30
                                                           target:self
                                                         selector:@selector(showNoServiceAlert)
                                                         userInfo:nil
                                                          repeats:YES];
    }
}

- (void)showNoServiceAlert
{
    UIAlertView *noServiceAlert = [[UIAlertView alloc] initWithTitle:@"对不起"
                                                             message:@"因为当前网络故障或者服务器故障,导致登陆服务器失败"
                                                            delegate:self
                                                   cancelButtonTitle:@"继续等待"
                                                   otherButtonTitles:@"手动选择城市",@"退出程序",nil];
    noServiceAlert.tag = kNoServiceAlert;
    [noServiceAlert show];
}

- (void)exitApplication
{
    [UIView beginAnimations:@"exitApplication" context:nil];
    
    [UIView setAnimationDuration:0.5];
    
    [UIView setAnimationDelegate:self];
        
    [UIView setAnimationTransition:UIViewAnimationCurveEaseOut forView:self.window cache:NO];
    
    [UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)];
        
    self.window.bounds = CGRectMake(0, 0, 0, 0);
    
    [UIView commitAnimations];
}

- (void)animationFinished:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
{    
    if ([animationID compare:@"exitApplication"] == 0)
    {
        exit(0);
    }
}

#pragma mark - Request TradeList - 请求支付列表

- (void)requestTradeList
{
    NSString *string    = [RequestCMD requestCMD:kRequestTradeList];
    NSMutableData *data = [RequestCMD getWantedData:string];
    [[SocketObject sharedInstance].gcdSocket writeData:data withTimeout:-1 tag:kRequestTradeList];
}

#pragma mark - RequestDaCheDou - 查询打车豆

- (void)requestDaCheDou
{
    NSString *string    = [RequestCMD requestCMD:kRequetDaCheDou];
    NSMutableData *data = [RequestCMD getWantedData:string];
    [[SocketObject sharedInstance].gcdSocket writeData:data withTimeout:-1 tag:kRequetDaCheDou];
}


@end

